jmcnamara / XlsxWriter

A Python module for creating Excel XLSX files.
https://xlsxwriter.readthedocs.io
BSD 2-Clause "Simplified" License
3.66k stars 632 forks source link

XlsxWriter Roadmap #653

Open jmcnamara opened 5 years ago

jmcnamara commented 5 years ago

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.
taozuhong commented 4 years ago

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.

jmcnamara commented 4 years ago

@taozuhong

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

Unfortunately no. That is too big a task.

taozuhong commented 4 years ago

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.

jmcnamara commented 4 years ago

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:

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.

arildb commented 3 years ago

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?

jmcnamara commented 3 years ago

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.

frndfrts commented 3 years ago

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

jmcnamara commented 2 years ago

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.

wilcoxon commented 2 years ago

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).

jmcnamara commented 2 years ago

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

dimiboi commented 1 year ago

@jmcnamara, any plans to implement data table support?

jmcnamara commented 1 year ago

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.

dimiboi commented 1 year ago

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

jmcnamara commented 1 year ago

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:

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

jmcnamara commented 9 months ago

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 commented 9 months ago

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.

tritueviet commented 9 months ago

Can you next for support open exist excel as template?

jmcnamara commented 9 months ago

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.

tritueviet commented 9 months ago

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

superAndroidMan commented 1 month ago

@taozuhong

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

Unfortunately no. That is too big a task.

I also have Excel templates that need to be read 😭

jmcnamara commented 1 week ago

As part of the XlsxWriter v2 refactoring I am looking for comments on: Refactoring of return values to Enums or Exceptions https://github.com/jmcnamara/XlsxWriter/issues/1100