简体   繁体   中英

Is there a way to append data to an excel file without reading its contents, in python?

I have a huge master data dump excel file. I have to append data to it on a regular basis. The data to be appended is stored as a pandas dataframe. Is there a way to append this data to the master dump file without having to read its contents.

The dump file is huge and takes a considerable amount of time for the program to load the file (using pandas).

I have already tried openpyxl and XlsxWriter but it didn't work.

It isn't possible to just append to an xlsx file like a text file. An xlsx file is a collection of XML files in a Zip container so to append data you would need to unzip the file, read the XML data, add the new data, rewrite the XML file(s) and then rezip them.

This is effectively what OpenPyXL does.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM