News for hackers. Stuff that matters.
Re:List of command line tools for manipulating CSV, XML, HTM... by stevoski on Sunday April 08, 2018 @03:59AM (#16785141)
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.

Re:List of command line tools for manipulating CSV, XML, HTM... by clarkdave on Sunday April 08, 2018 @04:15AM (#16785185)
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/

Re:List of command line tools for manipulating CSV, XML, HTM... by gwn7 on Sunday April 08, 2018 @04:13AM (#16785181)
Re:List of command line tools for manipulating CSV, XML, HTM... by reificator on Sunday April 08, 2018 @04:16AM (#16785187)
What an unfortunate choice of repository name. I definitely do not want to get Homebrew VD.
Re:List of command line tools for manipulating CSV, XML, HTM... by geocar on Sunday April 08, 2018 @04:50AM (#16785285)
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.
Re:List of command line tools for manipulating CSV, XML, HTM... by chrisweekly on Wednesday April 11, 2018 @04:30PM (#16815256)
https://github.com/SheetJS/js-xlsx is a solid choice for that kind of thing.
Re:List of command line tools for manipulating CSV, XML, HTM... by jwdunne on Sunday April 08, 2018 @04:09AM (#16785167)
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.

Re:List of command line tools for manipulating CSV, XML, HTM... by paulsutter on Sunday April 08, 2018 @04:03AM (#16785148)
Python is one easy / flexible way to wrangle Excel files
Re:List of command line tools for manipulating CSV, XML, HTM... by vram22 on Sunday April 08, 2018 @12:14PM (#16786763)
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.