TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Working with Excel Files in Python

22 pointsby kamaraju12 months ago

7 comments

nameless91212 months ago
I tried to do this in a previous job, it's _hard_. Our requirements were to use the math in a spreadsheet to calculate some results (basically actuaries created a set of formulae in the spreadsheet, we paste in the data and pull out the result). The best solution we found was to actually utilize LibreOffice and manipulate the spreadsheet using LibreOffice's Python API. There's no other solution that provides relatively complete implementations of Excel's functionality, and also updates cell values correctly taking into account complex formulae. And it was _painful_ and involved a very fiddly docker container image, a custom shell script with some LD_LIBRARY_PRELOAD magic, and some other hacks I don't even remember anymore.
评论 #40442237 未加载
评论 #40446214 未加载
评论 #40446202 未加载
aidos12 months ago
For those that don’t know - xlsx files are just zips. Change the extension and open them to see all the xml lurking within.<p>For what it’s worth we use xlsxwriter and are happy with it.
评论 #40443088 未加载
评论 #40443562 未加载
matthewfelgate12 months ago
I wrote some Python scripts last year (with the help of chatGPT) that use openpyxl and they work great.
评论 #40442694 未加载
snehk12 months ago
I&#x27;m so happy that, when working with .xlsx files, I usually only need the results. That&#x27;s why I always convert them (put them in a DB) and then do all the work there and export the results.<p>I read that Pandas works well, too, but I haven&#x27;t really tried it.
Pinus12 months ago
Why so many packages? Does it mean that all of them have some critical flaw, <i>and</i> are so hard to fix (for some reason) that everyone just starts from scratch instead of fixing an existing one?
JoeyBananas12 months ago
There is a certain type of office drone that likes to force bad ideas that involve abusing Excel spreadsheets to do something stupid. By doing what they want, you are doing them a disservice. It&#x27;s like feeding a stray cat or other urban pest.
ocdbg12 months ago
Job once had a requirement to generate reports in XLSB format.<p>Failed to find any Linux-based FOSS solution. Had to run a Windows Server.