Converting an entire spreadsheet to text files.

I have often the need to convert spreadsheets to text. The file -> save as trick is fine but will only save one sheet at a time. Often I get a spreadsheet with multiple workbooks and need to export the entire thing. For that I use xls2tab which is a perl program that cycles through the sheets and dumps them to comma seperated text files.

You’ll need to install a perl module but that is easy enough to do using cpan.

$ sudo perl -MCPAN -e shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support available (try 'install Bundle::CPAN')

cpan>  install Spreadsheet::ParseExcel::Simple

It may ask you a load of questions if this is the first time you ran cpan but the defaults have been sensible enough for me in the past. Once you’re finished type quit to exit. You can then run the program using the command

$ xls2tsv.pl test.xls

After that you’ll have a whole directory full of tab files.

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *