5

I am trying to use Libreoffice to convert a HTML file to XLS or XLSX format.

With LibreOffice 4.0.4.2 running on CentOS release 6.5 (Final) I was able to convert simple html to Microsoft XLS with the following command.

soffice --headless --convert-to xls my_file.html

I've been testing on the latest LibreOffice 5.0.4.2 without success. I'm using the following command and including the filter:

libreoffice5.0 --headless --convert-to xls:"MS Excel 97" test.html

It returns the following.

convert /path/to/test.html -> /path/to/test.xls using filter : MS Excel 97 Overwriting: /path/to/test.xls Error: Please verify input parameters... (SfxBaseModel::impl_store failed: 0xc10)

I haven't had any success in deciphering the error. Any tips appreciated on using libreoffice (recent versions) to convert from HTML to XLS/XLSX appreciated ... as well as other opensource tools that can accomplish the same task.

user3666158
  • 101
  • 1
  • 6

1 Answers1

5

No sooner do I post the question than I solve my problem.

The answer, to save you the trouble in the future...

libreoffice5.0 --headless --calc --convert-to xls:"MS Excel 97" test.html

Or more simply:

scalc --headless --convert-to xlsx test.html

Works perfectly and is relatively intuitive!

UrbanConor
  • 162
  • 1
  • 5
  • 16
user3666158
  • 101
  • 1
  • 6
  • Months later ... and I've put together what I learned into an article which I'm sharing at http://fileproprogramming.com/2016/04/21/filepro-created-excel-files-xls-libreoffice/ Ignore the filepro stuff (filepro is a legacy RAD ... it's just used to create the source html file being converted to XLS). It shows in more detail how to convert html into XLS with libreoffice including troubleshooting with strace. One thing I learned is that the source file has to have read, write, and execute permissions granted to the user. – user3666158 Apr 26 '16 at 15:38
  • For clarity, would you mind [accepting your own answer](https://stackoverflow.blog/2009/01/06/accept-your-own-answers/) as the solution? – TheDudeAbides Sep 26 '20 at 00:18