Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can anyone recommend a command line tool for manipulating Excel files, that runs on macOS?

Edit: I’m looking for a command line tool that allows me to open an Excel file, make a few simple changes, and then save again as an Excel file.



If you don’t mind converting the Excel file to CSV, csvkit[0], which is mentioned in the list, has a tool to pipe Excel into CSV for further processing by its sibling tools.

It won’t help if you need to retain anything Excel specific, but I find it very useful to deal with any Excel files that come my way.

[0] https://csvkit.readthedocs.io/en/1.0.3/



What an unfortunate choice of repository name. I definitely do not want to get Homebrew VD.


xlsx files are also zipfiles that contain xml, so you might get away with just unzipping them, then using some xml query, then zipping it back up.


https://github.com/SheetJS/js-xlsx is a solid choice for that kind of thing.


Ruby has a great gem too. I used it to migrate a client's membership data from an excel spreadsheet to a SQL data model.

This sheet was formatted like:

MEMBERS ...rows...

ADMINS ...rows...

EXECUTIVE COMMITTEE ...rows...

You could whip up any command line tool you need with that.


Python is one easy / flexible way to wrangle Excel files


Yes, there are multiple Python libraries for wrangling Excel files as well as good built-in CSV support via the stdlib's csv module - which, despite its name, can actually support DSV (Delimited Separated Values), which is a generalization of CSV. The csv module also has a dialects feature with attributes like settable delimiters (which is how you get the DSV support) and quoting. And since Python's built-in data structures like lists, dicts, tuples and sets are great for munging data, you can get a lot done with just that, plus the benefit of Python's readability and productivity.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: