Пример #1
0
def main():
    wb = Workbook()  # Creates a connection with a new workbook
    Range('A1').value = 'Foo 1'
    print Range('A1').value
    # 'Foo 1'
    Range('A1').value = [['Foo 1', 'Foo 2', 'Foo 3'], [10.0, 20.0, 30.0]]
    print Range('A1').table.value  # or: Range('A1:C2').value
    # [['Foo 1', 'Foo 2', 'Foo 3'], [10.0, 20.0, 30.0]]
    print Sheet(1).name
    # 'Sheet1'
    chart = Chart.add(source_data=Range('A1').table)
Пример #2
0
def main():
	wb = Workbook()  # Creates a connection with a new workbook
	Range('A1').value = 'Foo 1'
	print Range('A1').value
	# 'Foo 1'
	Range('A1').value = [['Foo 1', 'Foo 2', 'Foo 3'], [10.0, 20.0, 30.0]]
	print Range('A1').table.value  # or: Range('A1:C2').value
	# [['Foo 1', 'Foo 2', 'Foo 3'], [10.0, 20.0, 30.0]]
	print Sheet(1).name
	# 'Sheet1'
	chart = Chart.add(source_data=Range('A1').table)	
Пример #3
0
    def test_add_keywords(self):
        name = 'My Chart'
        chart_type = ChartType.xlLine
        Range('A1').value = chart_data
        chart = Chart.add(chart_type=chart_type, name=name, source_data=Range('A1').table)

        chart_actual = Chart(name)
        name_actual = chart_actual.name
        chart_type_actual = chart_actual.chart_type
        assert_equal(name, name_actual)
        if sys.platform.startswith('win'):
            assert_equal(chart_type, chart_type_actual)
        else:
            assert_equal(kw.line_chart, chart_type_actual)
Пример #4
0
    def test_add_keywords(self):
        name = 'My Chart'
        chart_type = ChartType.xlLine
        Range('A1').value = chart_data
        chart = Chart.add(chart_type=chart_type, name=name, source_data=Range('A1').table)

        chart_actual = Chart(name)
        name_actual = chart_actual.name
        chart_type_actual = chart_actual.chart_type
        assert_equal(name, name_actual)
        if sys.platform.startswith('win'):
            assert_equal(chart_type, chart_type_actual)
        else:
            assert_equal(kw.line_chart, chart_type_actual)
Пример #5
0
    def test_add_properties(self):
        name = 'My Chart'
        chart_type = ChartType.xlLine
        Range('Sheet2', 'A1').value = chart_data
        chart = Chart.add('Sheet2')
        chart.chart_type = chart_type
        chart.name = name
        chart.set_source_data(Range('Sheet2', 'A1').table)

        chart_actual = Chart('Sheet2', name)
        name_actual = chart_actual.name
        chart_type_actual = chart_actual.chart_type
        assert_equal(name, name_actual)
        if sys.platform.startswith('win'):
            assert_equal(chart_type, chart_type_actual)
        else:
            assert_equal(kw.line_chart, chart_type_actual)
Пример #6
0
    def test_add_properties(self):
        name = 'My Chart'
        chart_type = ChartType.xlLine
        Range('Sheet2', 'A1').value = chart_data
        chart = Chart.add('Sheet2')
        chart.chart_type = chart_type
        chart.name = name
        chart.set_source_data(Range('Sheet2', 'A1').table)

        chart_actual = Chart('Sheet2', name)
        name_actual = chart_actual.name
        chart_type_actual = chart_actual.chart_type
        assert_equal(name, name_actual)
        if sys.platform.startswith('win'):
            assert_equal(chart_type, chart_type_actual)
        else:
            assert_equal(kw.line_chart, chart_type_actual)
Пример #7
0
from xlwings import Workbook, Sheet, Range, Chart

wb = Workbook(r'C:\Users\mih\Desktop\Stock_Screener\Proj1.xlsx')

Range('A1').value = 'Two 2'

print Range('A1').value

Range('A1').value = [['Too 1', 'Foo 2', 'Foo 3'], [10.0, 20.0, 40.0]]

Range('A1').table.value  # or: Range('A1:C2').value

Sheet(1).name

chart = Chart.add(source_data=Range('A1').table)

wb.save("C:\Users\mih\Desktop\Stock_Screener\Proj1.xlsx")
Пример #8
0
import xlwings
from xlwings import Workbook, Sheet, Range, Chart

# Creates a connection with a new workbook
# wb = Workbook()  

wb = Workbook.caller()
Range('A1').value = 'Foo 1'
print Range('A1').value
Range('A1').value = [['Foo 1', 'Foo 2', 'Foo 3'], [10.0, 20.0, 30.0]]
print Range('A1').table.value  # or: Range('A1:C2').value
print Sheet(1).name
chart = Chart.add(source_data=Range('A1').table)	


# to open excel template
# from xlwings import Workbook
# Workbook.open_template()