vinci1it2000 / formulas

Excel formulas interpreter in Python.
https://formulas.readthedocs.io/
European Union Public License 1.1
358 stars 75 forks source link

Question - is it possible to import a openpyxl workbook? #96

Closed gal064 closed 2 years ago

gal064 commented 2 years ago

Instead of importing a file, can I import a openpyxl workbook/worksheet?

vinci1it2000 commented 2 years ago

Yes sure. Follows a code example:

>>> import formulas
>>> import openpyxl 
>>> wb = openpyxl.load_workbook('excel.xlsx')
>>> xl_model = formulas.ExcelModel()
>>> xl_model.books['PLACEMARK.XLSX'] = {formulas.BOOK: wb}
>>> xl_model.load('placemark.xlsx')
<formulas.excel.ExcelModel at ...>