I hate problems that can be solved really easily. (With a totally different set of tools). I needed to open Excel (XLS) files in PHP. Simple enough you think, IF you are using Windows.
BUT I am using Linux. Just to be awkward. So I don’t have any of those options.
AND to really confuse things, there are two packages called xls2csv.
- Ken Prows provides a Perl tool. View site.
- Vitus Wagner provides C tool part of the catdoc package. View site. (Currently down).
making a valid business decision being lazy pays off. I use Ubuntu. I can use apt to install catdoc
apt-get install catdoc
Job done. Usage is fairly straight forward. There is a man page here.
I slightly prefer Ken’s version of this tool for a few reasons;
- His site works. Well, not his, CPAN’s.
- It has a -q for quiet mode.
Here’s how I installed it,
First off, You need a whole bunch of modules you’ve never heard of before.
It’s probably worth throwing that lot into an interactive CPAN shell and letting it do the hard work.
perl -MCPAN -e 'shell'
- Spreadsheet::ParseExcel::FmtUnicode (Should come with the above).
Now, download the source from Ken Prows‘ site.
CPAN wouldn’t build xls2csv from the shell, but when I ran it manually, it seemed fine.
tar zxpfv xls2csv-1.06.tar.gz