Date: prev next · Thread: first prev next last
2017 Archives by date, by thread · List index




On 08/28/2017 02:46 AM, Cley Faye wrote:
2017-08-28 2:59 GMT+02:00 A <publicface@bak.rr.com>:

I'm trying to convert a file from .xlsx to CSV.  After googling until my
eyes were bleeding, the below is the best I could come up with.  I've tried
various incarnations of the below this is just the latest.  Any ideas
what's wrong here?  The input file clearly exists.  ubuntu 16.04
LibreOffice 5.1.6.2 10m0(Build:2)

Thank you in advance!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

apb@yellow:/usr/local/src/greetonix/src$ /usr/lib/libreoffice/program/soffice.bin
-env:UserInstallation=file:///tmp/libreoffice-1 --headless --nolockcheck
--convert-to csv:Text \(encoded\):UTF8 --infilter=MS Excel
97:44,34,76,1,,1033,true,true,false,false KGI_Discontinued.xlsx
Error: source file could not be loaded
Error: source file could not be loaded
Error: source file could not be loaded
convert /usr/local/src/greetonix/src/KGI_Discontinued.xlsx ->
/usr/local/src/greetonix/src/KGI_Discontinued.csv using filter : Text
Error: Please verify input parameters... (SfxBaseModel::impl_store
<file:///usr/local/src/greetonix/src/KGI_Discontinued.csv> failed: 0xc10)
apb@yellow:/usr/local/src/greetonix/src$



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/soffice* -rwxr-xr-x 1 root root 6304 Apr 28 12:36 /usr/lib/libreoffice/program/soffice.bin* -rw-r--r-- 1 root root 789 Apr 28 13:32 /usr/lib/libreoffice/program/sofficerc


- 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.

​- ​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 --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.


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.



--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.