I'm building OpenPyXL into an application that expects a string containing the content of the excel file, for it to write via file stream.
From my investigation into the OpenPyXL source code, it doesn't look like it supports this kind of output. Does anyone have any experience with modifying openpyxl to support this?
Or any general advice/workarounds?
Thanks.
Introduction. openpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files.
Step 3: Load with Openpyxl Still slow but a tiny drop faster than Pandas. Openpyxl Documentation: Memory use is fairly high in comparison with other libraries and applications and is approximately 50 times the original file size.
Further analysis of the maintenance status of openpyxl based on released PyPI versions cadence, the repository activity, and other data points determined that its maintenance is Healthy. We found that openpyxl demonstrates a positive version release cadence with at least one new version released in the past 12 months.
jcollado's answer is actually valid, but there is also a function (sadly not documented yet) called "save_virtual_workbook" in openpyxl.writer.excel that will take your workbook and return the workbook as a string:
from openpyxl.workbook import Workbook from openpyxl.writer.excel import save_virtual_workbook wb = Workbook() print save_virtual_workbook(wb)
What you're looking for is the string returned by save_virtual_workbook()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With