+ 3

Update excel with python

Hi everyone I’m trying to update an excel file with python, but when I save it it change format and remove style and formulas, Haw can I update an specific field keeping format as original?

28th Mar 2018, 4:33 AM
Joshue Perez
Joshue Perez - avatar
4 ответов
+ 6
This page links to a Python module to parse Office Open XML (not tested by me): http://fileformats.archiveteam.org/wiki/XLSX Thinking maybe Microsoft finally started documenting (@Highman's right), I found file formats: https://support.office.com/en-us/article/file-formats-that-are-supported-in-excel-0943ff2c-6014-4e8d-aaea-b83d51d46247?ui=en-US&rs=en-US&ad=US Sampling the BIFF8 format it got deep fast: "Understanding the binary format..." https://msdn.microsoft.com/en-us/library/office/gg615597(v=office.14).aspx "Structure of BIFF8..." http://docs.roguewave.com/stingray/11/html/ogug/26-2.html Automation (even SendKeys, or osascript on Mac) might be better than this.
28th Mar 2018, 5:10 AM
Kirk Schafer
Kirk Schafer - avatar
+ 5
Later versions of Excel use the Office Open XML File Format. They're basically ZIP archives. If you're not updating the files directly, are you automating a live spreadsheet by using some library (which one)? Note: I don't have Windows and I won't be able to continue past what I can test / find somewhere online. The above is intended to help clarify for others.
28th Mar 2018, 4:54 AM
Kirk Schafer
Kirk Schafer - avatar
+ 1
the format of MS documents is not open.If csv format is suficient for you use rather it insted of origin xls.
28th Mar 2018, 4:49 AM
Highman
Highman - avatar
0
Thanks for answering, however I need the xls format as file contain some formulas I would like to keep, and not sure if xml format can help, will try a shot
28th Mar 2018, 4:59 AM
Joshue Perez
Joshue Perez - avatar