Python Excel template read and re-write, maintaining formulae and formatting

后端 未结 1 770
抹茶落季
抹茶落季 2021-01-05 15:13

I\'ve run the gamut and can\'t seem to find what I\'m looking for. All threads I found here end up in dead ends for me. xlrd, xlwt, and xlutils almost do what I need, but… T

相关标签:
1条回答
  • 2021-01-05 15:51

    You can use openpyxl for this - it only supports xlsx (and the related formats), and not xls (the old Excel format).

    https://pypi.python.org/pypi/openpyxl/

    http://openpyxl.readthedocs.org/en/latest/

    https://bitbucket.org/openpyxl/openpyxl/src/2.2/doc/source/index.rst

    This package does preserve formulas when you open/save the Excel sheet. Also it does preserve formatting, but there are some minor issues with it. Images from the original Excel file are not preserved, though.

    Other cool features include support for conditional formatting, charts, sparklines, and many more.

    0 讨论(0)
提交回复
热议问题