Filter for ODS in --convert-to is not OpenDocument Spreadsheet Flat XML

I’ve found the filter for this format here: ODS_FlatXML.xcu\filters\fragments\config\source\filter - libreoffice/core - main, development code repository as suggested in this topic: Convert-to command line parameter.

When I type in the command:

libreoffice6.2 --convert-to ods="OpenDocument Spreadsheet Flat XML" *.doc

I get an error:

Error: no export filter for /media/…/test/Absent_en.ods=OpenDocument Spreadsheet Flat XML found, aborting.
Error: no export filter

I tried other combinations like doc>pdf and doc>odt and they all worked just by writing odt and pdf into the command, but for some reason even that lengthy filter is not enough!

Please help

P.S Other sites (like this one: http://www.ubuntubuzz.com/2016/08/libreoffice-command-line-convert-multiple-files-xls-to-ods.html) propose using

libreoffice6.2 --headless --convert-to ods *.doc

but even adding --headless doesn’t work

By the way - the “Flat” part of the question is unclear - ODS is not a Flat XML format: FODS is.

I’m just citing an official source that contains filter names for file formats. Maybe objectively speaking it is not flat, but it is definitely called that way internally.

No, they are not :slight_smile: you just found the .XCU for FODS. For proper ODS, ther’s another .XCU: calc8.xcu\filters\fragments\config\source\filter - libreoffice/core - main, development code repository. The naming of our files reflects long legacy of the suite history :wink:

Fair point then, won’t argue :slight_smile:

Well - of course, the ‘ods=“OpenDocument Spreadsheet Flat XML”’ format is invalid - could you please share where did you find that syntax, so that we could clarify/fix the wrong statement. The relevant help topic mentions how to properly specify the specific filter - using colon …

But then - the command with the proper syntax would not work, either. Because your conversion - from binary text document format DOC to spreadsheet ODS - does not generally make sense.

In general, when you try some automated conversion using --convert-to, you possibly first want to test how to do that manually, using GUI. You first open the original file with LibreOffice - e.g., use “Open with LibreOffice” shell function, or somesuch, which invokes generic soffice file.ext-like command. Then you try to save as/export to a desired file type, and see if it’s possible. If it is not, then likely it also won’t work in command like, unless you do some additional steps.

E.g., you might need to open the file specially. This is the case when people want to convert PDFs to text documents: by default, PDFs are opened using Draw module in LibreOffice; and Draw does not have export filters to save to text documents. But LibreOffice can import to Writer if told so explicitly - so one would need to specify import filter first, to be able then to export to desired text document format. So one would see that special treatment was needed when opening in GUI: one has to specify import filter in Open dialog explicitly - and that would give a hint about what is needed in automated scenario.

Or one could need to do an extra conversion step. This is the case here: only Calc can export to ODS - so you need to open document in Calc; but there’s no import filter for DOC in Calc. Still, there are text formats that may be imported to Calc: they are RTF and HTML. So - you could want to open your DOC in Writer, then export to RTF, then open the exported RTF in Calc (explicitly specifying import filter), then export to ODS … for whatever reason.

This worked. Also some combinations that didn’t worked before started working when I appended --calc to the command. Thanks