8000 >> updated open_excel() example · alixdamman/larray@4f9febc · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 4f9febc

Browse files
committed
>> updated open_excel() example
1 parent 8c00ba0 commit 4f9febc

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

larray/inout/xw_excel.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,16 +815,28 @@ def open_excel(filepath=None, overwrite_file=False, visible=None, silent=None, a
815815
816816
>>> # to create a new Excel file, argument overwrite_file must be set to True
817817
>>> with open_excel('excel_file.xlsx', overwrite_file=True) as wb: # doctest: +SKIP
818+
... # create a new sheet 'arr' and dump the array 'arr' starting at cell A1
818819
... wb['arr'] = arr.dump()
819-
... wb['arr']['A6'].add_table()
820-
... wb['arr']['G1'].add_plot('A1', title='simple graph')
820+
...
821+
... # dump array 'arr2' starting at cell F1
822+
... wb['arr']['F1'].add_table(arr2)
823+
...
824+
... # add a plot with left top corner anchored to cell A6 and
825+
... # using data in range A1:D4
826+
... wb['arr']['A6'].add_plot('A1:D4', title='simple graph')
827+
...
828+
... # add a plot with left top corner anchored to cell F6 and
829+
... # using data in range F1:H3 where H3 is deduced automatically
830+
... wb['arr']['F6'].add_plot('F1', title='second simple graph')
831+
...
832+
... save the workbook
821833
... wb.save()
822834
823835
read array from an Excel file
824836
825837
>>> with open_excel('excel_file.xlsx') as wb: # doctest: +SKIP
826-
... arr2 = wb['arr'].load()
827-
>>> arr2 # doctest: +SKIP
838+
... arr3 = wb['arr'].load()
839+
>>> arr3 # doctest: +SKIP
828840
a\b b0 b1 b2
829841
a0 0 1 2
830842
a1 3 4 5

0 commit comments

Comments
 (0)
0