XlsxWriter icon indicating copy to clipboard operation
XlsxWriter copied to clipboard

XlsxWriter Roadmap

Open jmcnamara opened this issue 4 years ago • 19 comments

I write and maintain 4 libraries for writing Xlsx files in 4 different programming languages with more or less the same APIs:

See also Note 1.

New features get added to the Perl version first, then the Python version and then the C version. As such a feature request has to be implemented 4 times, with tests and documentation. The Perl and Python versions are almost completely feature compatible. The C version is somewhat behind the others and the Rust version is a work in progress.

This document gives a broad overview of features that are planned to be implemented, in order.

  1. Bugs. These have the highest priority. (Note 2)
  2. ~~Add user defined types to the write() method in XlsxWriter.~~ #631 Done.
  3. ~~Add hyperlinks to images in Excel::Writer::XLSX Issue 161, fix it in the Python version, and add it to the C version.~~ Done
  4. ~~Learn the phrygian dominant mode in all keys.~~ Close enough.
  5. ~~Fix the issue where duplicate images aren't removed/merged.~~ #615 In Python, Perl and C versions. Done
  6. ~~Add support for comments to the C version~~ https://github.com/jmcnamara/libxlsxwriter/issues/38. Done
  7. ~~Add support for object positioning to the C version.~~ Done
  8. ~~Add support for user defined chart data labels.~~ #343 This is the most frequently requested feature across all the libraries. Done
  9. ~~Add header/footer image support to the C version.~~ Done
  10. Learn the altered scale in all keys.
  11. ~~Add conditional formatting to the C library.~~ Done
  12. ~~Add support for new Excel dynamic functions.~~ Done
  13. ~~Add autofilter filter conditions to the C library.~~ Done
  14. ~~Drop Python 2 support.~~ #720
  15. ~~Add table support to libxlsxwriter.~~ Done
  16. Implement missing features in the C library.
  17. Other frequently requested, and feasible, features, in all 3 versions.

Update for 2023: I will implement a simulated column autofit method in the Python library. The majority of any other effort will go into getting the Rust version of the library to feature compatibility with the Python version.

Notes:

  1. I also wrote a version in Lua, and two other Perl versions (for older Excel file formats) that I no longer actively maintain. I wrote, and open sourced, the first version in January 2000.
  2. Some avoidable bugs have lower priority.

jmcnamara avatar Aug 31 '19 17:08 jmcnamara

I've been watch you and your projects long time, just want to say thank for your great work.

BTW. could you will create library: libxlsx to put xlsx writer and reader toghter in C?

because libxlsx in C could wrapped with python , perl and lua language, that make three projects share a code base, and easy to maintain.

taozuhong avatar Mar 28 '20 06:03 taozuhong

@taozuhong

could you will create library: libxlsx to put xlsx writer and reader together in C

Unfortunately no. That is too big a task.

jmcnamara avatar Mar 28 '20 08:03 jmcnamara

Yeah, it's a big task, but you are the right person to create the project and make a road-map, maybe I or others could give it a hand to make it done.

Just try it, put others to time.

taozuhong avatar Mar 29 '20 06:03 taozuhong

but you are the right person to create the project and make a road-map, maybe I or others could give it a hand to make it done.

Thank you for the vote of confidence. I actually started creating an Xlsx reader in Perl a few years ago (Excel::Reader::XLSX). However, although it worked for its use case (of reading data from an Xlsx file) it became clear that even for that subset it was a very big task. Some of the issues were:

  • The Xlsx XML spec is quite permissive. This is good but allows a wide range of "valid" xlsx formats produced by different (non-Excel) tools that are hard to parse.
  • People rarely want to read just data. They want to know obscure things like which fonts were used in a rich string.
  • Also, I have a somewhat completist approach to software so this wouldn't be a task that I think I could finish to the standard that I would like.

So, overall this isn't something that I want to attempt, even from a co-ordination point of view. However, there are other Open Source libraries in a variety of languages that support reading and rewriting Excel Xlsx files.

jmcnamara avatar Apr 01 '20 10:04 jmcnamara

Excel has support for comments and notes in a cell. The current API only supports comments, it seems.

Will note support be added, or is there a way to create cell notes currently?

arildb avatar Mar 03 '21 06:03 arildb

Will note support be added

It is unlikely. There are several additional subfiles within the file format that are required to support this. Also, since this feature was only added in recent versions of Excel it makes writing tests a little tricky.

jmcnamara avatar Mar 03 '21 09:03 jmcnamara

Any plans on supporting the definition and application of Excel Styles to cells? Thanks.

frndfrts avatar Dec 02 '21 22:12 frndfrts

Any plans on supporting the definition and application of Excel Styles to cells?

Do you mean "Cell Styles" like like on the "Home" tab of the Excel ribbon bar? If so there aren't any plans to support those. The internal handling of styles is tricky and has to be managed carefully in relation to normal cell formats. Also, it isn't a frequently requested feature so overall it is unlikely to be supported.

jmcnamara avatar Dec 03 '21 15:12 jmcnamara

I know it is not possible to do AutoFit for columns. Is it possible to implement autosize for comments (eg set comment_object.Shape.TextFrame.AutoSize = True)? Unlike column AutoFit, this appears to persist across edits to the comments which makes me think it is a "real" setting (and not just runtime calculations within Excel).

wilcoxon avatar Mar 08 '22 07:03 wilcoxon

@wilcoxon I think that should be possible. Can you open a new feature request for it.

jmcnamara avatar Mar 08 '22 07:03 jmcnamara

@jmcnamara, any plans to implement data table support?

dimiboi avatar Dec 27 '22 20:12 dimiboi

any plans to implement data table support?

They may work already as a normal formula. There is some additional attributes require but Excel may just calculate it anyway. Otherwise it isn't requested enough (this is the first time) to add to the roadmap.

jmcnamara avatar Dec 28 '22 12:12 jmcnamara

Unfortunately, it doesn't seem to work as a normal formula unless there is a workaround that I am not aware of.

dimiboi avatar Dec 29 '22 10:12 dimiboi

Roadmap V2

XlsxWriter is almost 10 years old. The first version was released was in February 17 2013. According to pypinfo it has around 12 million monthly downloads so it is probably fair to say that it has been useful.

Recently I have been porting/rewriting XlsxWriter in Rust and it has been an interesting experience. When I'm finished with the Rust port, sometime next year, I'd like to revisit XlsxWriter and bring it up to date with modern Python and practice. Some ideas:

  • Type annotation with documentation on all (200) public APIs.
  • Better error handling and reporting. Also better API argument testing with the help of the type annotations.
  • More exceptions.
  • A Image type like in the Rust version. This would make improvements like a worksheet.insert_image_fit_to_cell() method easier to implement.
  • A Color type like in the Rust version which will allow a uniform implementation of theme colors (often requested).
  • Maybe a Formula type like in the Rust version.
  • Better autofit().
  • More modular structuring of the Chart internals to allow more formatting.
  • Other cleanups and refactoring.

Update: I've moved this to its own issue for comments and suggestions.

jmcnamara avatar Nov 03 '23 20:11 jmcnamara

XlsxWriter v3.2.0 has been released with support for embedded images in cells. This is equivalent to Excel's menu item to insert an image using the option to "Place in Cell". It scales images automatically to the dimensions of the cell.

This has been a frequently requested feature for people creating spreadsheets with images for product items.

Example:

import xlsxwriter


# Create an new Excel file and add a worksheet.
workbook = xlsxwriter.Workbook("embedded_images.xlsx")
worksheet = workbook.add_worksheet()

# Widen the first column to make the caption clearer.
worksheet.set_column(0, 0, 30)
worksheet.write(0, 0, "Embed images that scale to cell size")

# Embed an images in cells of different widths/heights.
worksheet.set_column(1, 1, 14)

worksheet.set_row(1, 60)
worksheet.embed_image(1, 1, "python.png")

worksheet.set_row(3, 120)
worksheet.embed_image(3, 1, "python.png")

workbook.close()

Output: screenshot 2

jmcnamara avatar Feb 18 '24 23:02 jmcnamara

Also, just to note that v3.2.0 is the 10th anniversary release of XlsxWriter.

Version 0.0.1 was released on February 17 2013. Since then there have been 167 releases, 25,000 lines of code, 1600 test cases, 700 pages of documentation, 71,000 users on GitHub, 50 contributors, 1000 closed issues and 150 million yearly downloads.

Thanks to everyone who has contributed code, given feedback or just used the library.

jmcnamara avatar Feb 18 '24 23:02 jmcnamara

Can you next for support open exist excel as template?

tritueviet avatar Feb 24 '24 03:02 tritueviet

Can you next for support open exist excel as template?

An Excel file can't (except for very simple cases) be templated like a text file or a html file since it is actually a collection of files and they have inter-referential linkages. So in general you need to parse the file into a collection of data structures and then write it out again. I gave an explanation a bit further up this thread about why I don't plan to tackle file reading: https://github.com/jmcnamara/XlsxWriter/issues/653#issuecomment-607173901

So, unfortunately, this is something that I won't be tackling. OpenPyXL does a good job of supporting file reading/templating if you care to look at that.

jmcnamara avatar Feb 24 '24 10:02 jmcnamara

Can you next for support open exist excel as template?

An Excel file can't (except for very simple cases) be templated like a text file or a html file since it is actually a collection of files and they have inter-referential linkages. So in general you need to parse the file into a collection of data structures and then write it out again. I gave an explanation a bit further up this thread about why I don't plan to tackle file reading: #653 (comment)

So, unfortunately, this is something that I won't be tackling. OpenPyXL does a good job of supporting file reading/templating if you care to look at that.

Thanks very much. i think i need using other open source to rewrite the data

tritueviet avatar Feb 24 '24 11:02 tritueviet