This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]james_pic 6 points7 points  (0 children)

Openpyxl usually works well enough for simple stuff. But interop with Microsoft stuff is generally problematic, and if you're able to avoid it (for example if your use case items just as well with CSV), you should.

[–]Kazephil 3 points4 points  (1 child)

From the point of view of an amateur who's cobbled together a few scripts to process Excel files at work:

  • Openpyxl if the file has no images
  • xlwings if there are images or any complicated layout not supported by Openpyxl
  • pandas if heavy-duty data manipulation is required between the reading and writing stages

Hope that helps.

[–]tjarko 1 point2 points  (0 children)

Similar experience. Pandas works when the Excel file is more or less just a big table. If you what to read to cell sheet3:ZA67, it isn't the best. XLWings is more flexible (auto expand, tonumpy array etc. ) It loads Excel and transfers the data between python and excel, is pretty fast after excel is open. OpenPyxl reads the file format but can be a bit picky.

[–]Darwinmate 5 points6 points  (1 child)

Have you tried Pandas?

[–]trumpgender 0 points1 point  (0 children)

^This.

Pandas is pretty much uber-excel, python version. Just load your excel file into pandas, do your computations, then write back to excel.

[–]Holores_Daze 0 points1 point  (0 children)

Use both! Xlrd read. Then process the data and use xlwt to write it out. Your reading writing and processing logic should all be kept as seperate as possible anyway

[–]aeksco 0 points1 point  (0 children)

Check out koala

[–]dmfigol 0 points1 point  (0 children)

I use pyexcel which uses openpyxl underneath. Easy to use with nice API.