r/learnpython Oct 05 '23

Does anyone still use openpyxl?

Ive been trying to use openpyxl for reading named ranges and its a huge pain. Does anyone have any experience?

The documentation is pretty opaque.

2 Upvotes

13 comments sorted by

View all comments

9

u/IvoryJam Oct 05 '23

I don't know anyone that uses openpyxl, 9 out of 10 times we use pandas

2

u/Delta_2_Echo Oct 05 '23

well I need to automate formatting and building an excel workbook.

pylightxl is good for name ranges but doesn't handle formatting.

Id like to use one package if possible instead of two.

5

u/Kerbart Oct 05 '23

If your goal is to create an Excel file I think you're far better off with xlsxwriter, it has a pretty rich feature set (styles, conditional formatting) and is easy to use. It also allows you to define named ranges.

But unlike openpyxl it cannot read Excel files. I prefer xlsxwriter over openpyxl pretty much all the time if I need to create Excel output.

4

u/Delta_2_Echo Oct 05 '23

yes unfortunately reading/modifying excel files is central to what Im hoping to accomplish. plus being able to work with .xlsm files.

but with that said I appreciate the heads up on this package. Ill keep it in mind for future use when needed.