vallettea / koala

Transpose your Excel calculations into python for better performances and scaling.
GNU General Public License v3.0
143 stars 60 forks source link

add to_xlsx function #262

Open charlesdwright opened 2 years ago

charlesdwright commented 2 years ago

Dumps sheets, cells and formulae from graph to xlsx Todo: handle ranges, test with larger & more complex sheets, ?

Specific case:

‘’’Create workbook and spreadsheet instance’’’
>>> from koala.ExcelCompiler import ExcelCompiler
>>> from koala.Spreadsheet import Spreadsheet
>>> sp_scratch = Spreadsheet()

‘’’Create graph manually per docs”
>>> sp_scratch.cell_add('Sheet1!A1', value=1)
>>> sp_scratch.cell_add('Sheet1!A2', value=2)
>>> sp_scratch.cell_add('Sheet1!A3', formula='=SUM(Sheet1!A1, Sheet1!A2)')

>>> sp_scratch.cell_add('Sheet2!A4', value=1)
>>> sp_scratch.cell_add('Sheet2!A5', value=2)
>>> sp_scratch.cell_add('Sheet2!A6', formula='=SUM(Sheet2!A4, Sheet2!A5)')

‘’’Dump graph to .xlsx’’’
>>> sp_scratch.to_xlsx('blah')

Screen Shot 2022-06-11 at 7 00 57 PM Screen Shot 2022-06-11 at 7 01 05 PM

charlesdwright commented 2 years ago

It's now called "to_excel()" and supports output of named ranges.