> > >> Some things seems wrong on that command line: >> >> - On most system you can directly call "libreoffice" instead of providing >> the full path >> > > Yes, but then I get /usr/bin/libreoffice since /usr/bin is in my path. > /usr/bin/libreoffice is a symlink to ../lib/libreoffice/program/soffice* > > Note the file sizes and timestamps. I don't know what the difference is > between the two or which is correct to use. > > ll /usr/lib/libreoffice/program/soffice* > -rwxr-xr-x 1 root root 6012 Apr 28 07:59 /usr/lib/libreoffice/program/s > office* > -rwxr-xr-x 1 root root 6304 Apr 28 12:36 /usr/lib/libreoffice/program/s > office.bin* > -rw-r--r-- 1 root root 789 Apr 28 13:32 /usr/lib/libreoffice/program/s > officerc > > The "libreoffice" command/link is there to avoid issues when/if the way LibreOffice is installed change. Suppose in a future release the binary is renamed to loffice, you could still use the libreoffice command without issue. The "soffice" script manage some extra command line parameters and launch the actual LibreOffice program; but for your purpose it should make no difference using one or the other, except that directly calling stuff in /usr/lib/libreoffice is not as futureproof.
> > - I'm not sure the -env:UserInstallation part is needed, unless you have >> some specific requirements >> > > Yes. I typically have LO open 24/7 with other documents. It should not matter when doing a convert-to. This command is useful if you want to launch an instance of LibreOffice using a different place to store your configuration/etc. You can have many document open in LibreOffice and use the command line at the same time. > > > - the \(encoded\):UTF8 part is not linked to anything, and thus is used >> as an input filename. This is most likely not what you want. >> > > Could you elaborate what you mean by not linked to anything? This is > probably the key to what I'm doing wrong. To what would I link it, and how? The command line is parsed argument by argument. An argument is a single string, and arguments are separated by a space. Sometime an argument expect a parameter in place of the next argument. This is common practice for command lines. In your case, you had: --convert-to csv:Text \(encoded\):UTF8 Which mean that you have three strings: "--convert-to", "csv:Text" and "(encoded):UTF8". "--convert-to" is the argument, "csv:Text" is a parameter to the argument, and "(encoded):UTF8" is "nothing", meaning it is interpreted as an input filename, so your initial command was trying to open a file named "(encoded):UTF8". > - the --infilter might not be needed, as xlsx files should have enough >> informations about themselves to load properly. >> > > OK, I'm all for simplicity. But I couldn't find anything in the docs that > specifies that, which is why I used it. Plus the fact that all of the > examples scattered around the Net use it, else I likely wouldn't have been > able to decipher the docs. > > I was able to convert an xlsx to a csv in UTF-8 using the following simple >> command: >> >> $ libreoffice --headless --nolockcheck --convert-to csv >> --infilter=CSV:44,34,76,1 a.xlsx >> > > I tried exactly as you stated (I of course replaced with the proper file > to convert) but for me, that had no result. There were no messages of any > kind, and the file was not created. > > infilter does refer to the source file, yes? As my input/source file is > .xlsx, I tried changing CSV in your --infilter, to MS Excel 97, but that > made no difference in the result. > > --infilter does not necessarily related to the input; order is important. It's hard to say what went wrong, but here's my own result (with LibreOffice version): $ ls -l total 16 -rw-rw-r-- 1 cleyfaye cleyfaye 5374 août 29 10:05 a.xlsx $ file a.xlsx a.xlsx: Microsoft OOXML $ libreoffice --headless --nolockcheck --convert-to csv > --infilter=CSV:44,34,76,1 a.xlsx $ ls -l total 28 -rw-rw-r-- 1 cleyfaye cleyfaye 25 août 29 10:13 a.csv -rw-rw-r-- 1 cleyfaye cleyfaye 5374 août 29 10:05 a.xlsx $ file a.csv a.csv: UTF-8 Unicode text $ cat a.csv "a", "b", ,"c" ,"héhé" $ libreoffice --version LibreOffice 5.3.1.2 30m0(Build:2) There's no need for other parameters to do an xlsx->csv(utf8) conversion. If that simple command doesn't work, maybe there's another issue. You could even remove the --nolockcheck if you're sure that the file isn't open anywhere else and remove the --headless if you're not running this command on a server, it should still work. > The "76" is responsible for generating an UTF-8 CSV output. If that is not >> one of your requirements, you can slim this down even more: >> > > I do in fact prefer UTF-8 CSV output. > > For information, the "44,34,76,1" thing come from this page (the CSV part is still applicable to LibreOffice): https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options -- To unsubscribe e-mail to: [email protected] Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
