How to convert to CSV with UTF-8 encoding using LO5 command line?

When I try

soffice --headless --convert-to csv myfile.xlsx

the resulting file has no UTF-8 encoding.

I found out that I have to use the output filter “Text - txt - csv (StarCalc)” followed by a list of parameters, like so:

soffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":<listofparameters>

The Problem is none of the solutions I found worked for me. I always get the error message:

Error: Please verify input parameters... (SfxBaseModel::impl_store <file:///path/to/myfile.csv> failed: 0x81a)

I noticed that the solutions I found refered to LO4. So maybe the input format has changed? Unfortunately, I can’t find any documentation on that.

My LibreOffice version is

And what did you specify for ?

I found examples with 3, 5, 7 or 9 paramters, mostly from other questions on E.g “59,34,0” or “59,34,76,true” or “59,34,0,0,1”. The odd thing is, they all work now. I’m not sure what has changed. I tried to make it work like 2h and double and triple checked the syntax. Still seems like i had a typo and was to blind to see it. At least I have no better explanation…

If the third argument is 0 it means “use system character encoding” (or actually the process’ default encoding) which is UTF-8 if your system uses UTF-8 but something different if not.

soffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":44,34,76 myfile.xlsx

where 76 is the number of the UTF-8 encoding (and 44 the comma and 34 the double quote character ASCII value). For details of the filter options see CSV Filter parameters in online help.
[Update 2022-02-07T20:52+01:00 link to new online help].

This works, thank you very much!

great answer, thx.