willtrnr / pyxlsb

Excel 2007+ Binary Workbook (xlsb) reader for Python
GNU Lesser General Public License v3.0
90 stars 21 forks source link

Add basic writing of workbooks #29

Closed applio closed 2 years ago

applio commented 4 years ago

This PR adds a basic capability to create and write sheets to XLSB workbooks.

Examples added to the README.md demonstrate writing data from pandas.DataFrame, numpy.ndarray, or list-of-lists to new sheets in a new workbook. Attempts are made to exploit speedups possible when writing DataFrames/NumPy-arrays versus needing to incrementally inspect the contents of list-of-lists style data.

At present, all test XLSB files created by the code in this PR are readable by the current Office365 Excel, Excel 2010, as well as pyxlsb itself. The PR's code has been exercised on Windows 10 and MacOS mostly using Python 3.8. Attempts were made to preserve compatibility with Python 2.7 as that appeared to be an unspoken goal of the pyxlsb project, though that has not been fully tested.

This PR was developed against the "v1.0.x" branch initially because of a mis-reading what was going on in willtrnr/pyxlsb's master branch. In hindsight, it is still a little unclear if this was the right or wrong choice given some of the restructuring that has happened in master versus v1.0.x branches. Perhaps having developed against "v1.0.x" permits a faster path to accepting this PR and a subsequent release? I am happy to work towards bringing this PR's functionality in line with the changes in the master branch if that would be preferred.

I hope that this PR can already be of interest and use or at least will trigger discussion. Other areas for nearer-term improvement on this PR might include:

willtrnr commented 4 years ago

@applio thank you for tackling this.

I am happy to work towards bringing this PR's functionality in line with the changes in the master branch if that would be preferred.

I'll take you up on that, please target master for this PR as it's the eventual 1.1.0 release. I didn't feel there was enough user-facing improvement in master to cut a release yet, but this here could tip the scales. I intend on only pushing fixes for the 1.0.x series.

This is on the larger side, so it'll take some time to review. Since you'll have to rework things for the integration in master, here's a few preliminary things I've noticed:

PratikStar commented 2 years ago

Why is it not merged yet? Any issues?

willtrnr commented 2 years ago

Why is it not merged yet? Any issues?

Yes, the issues in the comment above yours.

wiserguy1964 commented 2 years ago

Hi, may i ask someone if it is possible to write/append data to an existing sheet or it has to be a new sheet every time?

willtrnr commented 2 years ago

Closing for inactivity