4

I have a set of CSV files, which I need to convert to a single ODS (or even excel) spreadsheet with multiple tabbed worksheets. Currently I'm using the pyexcel library for python, but it's buggy and horribly slow.

Libreoffice has a nice file conversion utility, but I don't see any support for worksheet tabs. Is there a simple way to script this?

Rachie
  • 433
  • 1
  • 6
  • 17
  • So you want to use Calc to open (large number of?) files, then copy the Sheet1 of all the files into one main file? – Lyrl Aug 31 '15 at 17:51
  • I want some way to merge multiple CSV files into a single ODS file, with each CSV getting its own Sheet1, Sheet2, etc. – Rachie Sep 01 '15 at 06:17
  • how have you tried with pyexcel? what are the bugs you have seen? for tab separated csv file, pyexcel expects '*.tsv'. – chfw Sep 01 '15 at 10:11
  • Would a macro (in language of your choice) like this work: use Calc to open the CSV file with appropriate filter selections, rename tabs to something like "CSVfilename_Sheet1"; repeat for the next CSV file, copy all the sheets from the second file into the first one, close the second file without saving; repeat for all CSV files; save the first file? I wouldn't call it simple, I guess, but I'm not sure how else you'd automate this kind of thing. – Lyrl Sep 01 '15 at 14:53

1 Answers1

11

Came to this thread over 800 days since this question was asked, but I just got done doing the exact same thing and will post the process.

QUICK COMMAND FOR UBUNTU LINUX:

sudo apt-get install gnumeric ssconvert --merge-to=OUTPUT-FILE.xls *.csv

MORE DETAILS:

  1. Make sure you have access to a Linux or Mac computer.

  2. Install the gnumeric program. So sudo apt-get install gnumeric for Debian/Ubuntu, sudo dnf install gnumeric for RHEL, or brew install gnumeric for Mac.

  3. Run ssconvert --merge-to=OUTPUT-FILE.xls *.csv.

  4. *.csv will select every csv file in your current folder. You can also just enter multiple file names if you want as well.

  5. If you're running on Linux and have installed LibreOffice, you can open this file directly from the command line via libreoffice OUTPUT-FILE.xls
Danora
  • 315
  • 3
  • 9