Page 1 of 1

[Solved] Convert .ods file to csv

PostPosted: Wed May 18, 2016 10:19 pm
by CJenR
Hello!

Can someone help me to convert from .ods file to csv. I tried soffice --headless --convert-to csv filename.ods, but it is not working. It just opens the .ods file.

Re: Convert .ods file to csv

PostPosted: Thu May 19, 2016 12:22 am
by acknak
Greetings and welcome to the community forum!

The command line you quoted works for me with AOO 4.1.2. You may need to track down what "soffice" at the command line actually does. It could be a shell script that doesn't process the options as expected. If so, directly starting the soffice executable that comes with OO using the full path (that's what I did when it worked).

Also, are you still using OO 3.4.1? That's pretty old at this point. It might be worth at least trying the current version.

Re: Convert .ods file to csv

PostPosted: Thu May 19, 2016 1:41 am
by MrProgrammer
Hi, and welcome to the forum.

CJenR wrote:I tried soffice --headless --convert-to csv filename.ods, but it is not working.
"it is not working" isn't helpful in the forum because it tells us what did not happen. Please never use that phrase in a post. We need to know exactly what actions you took, what did happen, and what you expected to happen. Often "it didn't work" means "it didn't do what I expected" and the real problem is that the system is behaving correctly but your expectations are incorrect.

Perhaps your problem is that the operating system can't find the soffice module. Help it by providing the full path in the command, which in my case is /Applications/OpenOffice.org.app/Contents/MacOS/soffice …, or by using the cd command to make the directory containing soffice the current directory and using ./soffice ….

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.

Re: Convert .ods file to csv

PostPosted: Thu May 19, 2016 11:13 am
by Villeroy
You've got to use LibreOffice rather than OpenOffice. The latter does not know any --convert-to option.

Re: Convert .ods file to csv

PostPosted: Thu May 19, 2016 1:34 pm
by acknak
Ouch. Villeroy is exactly right. I should take my own suggestion: the "soffice" I was using was actually starting LibO, not AOO.

Sorry, my bad.

Re: Convert .ods file to csv

PostPosted: Thu May 19, 2016 4:51 pm
by CJenR
Thank you for all the inputs!

Though soffice does not throw me any error, I believe as you said, it doesn't know --convert-to option. As of now I can not change openoffice version or to LibreOffice. Is there any other way to convert my ods file to csv in this AOO version?

Re: Convert .ods file to csv

PostPosted: Thu May 19, 2016 4:57 pm
by RoryOF
What's wrong with /File /Save As : Text CSV (.csv) from the dropdown?

Re: Convert .ods file to csv

PostPosted: Thu May 19, 2016 5:05 pm
by CJenR
No.. My shell script has to do it. No manual intervention. So, Is there any other ways to do it? or any other suggestion.

Re: Convert .ods file to csv

PostPosted: Thu May 19, 2016 5:24 pm
by RoryOF
CJenR wrote:No.. My shell script has to do it. No manual intervention. So, Is there any other ways to do it? or any other suggestion.


You didn't say that - you asked about "file" in the singular.
Macro at
https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=19695
and another at
https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=2551
and more at
https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=75404

These may need some fine tuning because of changes in OO/LibO code, but as you wish to use a macro you are no doubt prepared to do that.

Re: Convert .ods file to csv

PostPosted: Thu May 19, 2016 8:38 pm
by CJenR
I went through the links though I was hoping for a simpler solution instead of using a Macro :)
I came across unoconv package which can be used to convert files. I installed it and It worked as a charm.

Anyway thank you for helping me! 8-)