Bug 74518 - Conversion from csv to xls, xlsx incorrect
Summary: Conversion from csv to xls, xlsx incorrect
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.4.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-04 17:12 UTC by Wilhelm Horrix
Modified: 2015-01-22 22:05 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
corresponding csv file (3.70 KB, text/csv)
2014-02-04 17:12 UTC, Wilhelm Horrix
Details
Generated xls file (14.55 KB, application/vnd.ms-excel)
2014-02-04 17:15 UTC, Wilhelm Horrix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wilhelm Horrix 2014-02-04 17:12:42 UTC
Created attachment 93386 [details]
corresponding csv file

When opening attached csv file and saving it into xlsx format, conversion works correctly !!!

However, when using a php script 
$lCmd = '/opt/libreoffice4.1/program/scalc --headless --convert-to xls ' . $this->csvSheet->fileName;
$rtn = system($lCmd,&$rtnVal);

the conversion fails with many errors. 

Help is appreciated.
Comment 1 Wilhelm Horrix 2014-02-04 17:15:10 UTC
Created attachment 93388 [details]
Generated xls file
Comment 2 gagrilli 2014-02-04 18:09:15 UTC
(In reply to comment #0)
> Created attachment 93386 [details]
> corresponding csv file
> 
> When opening attached csv file and saving it into xlsx format, conversion
> works correctly !!!
> 

I'm not quite sure what you mean when sayin "correctly".
Using the same platform and LibreO version, the file imports with some errors, using the default options in the import dialogue.

Could you elaborate on the options you selected? What was the expected xlsx file?

I any case , some options must be present in the command line, indicating to the headless instance what should it do with the CSV data (e.g. separator, quoting,  etc. ). Those options exist, albeit hard to find...

This is a non-trivial CSV i think, so you cannot expect the defaults to work out of the box.

Version: 4.1.4.2
Build ID: 410m0(Build:2)
OS: opensuse 64bit 12.2
Comment 3 Maxim Monastirsky 2014-08-24 12:22:16 UTC
The problem here is that the csv file has .txt extension that defaults to Writer, and you can't use Calc export filters for a Writer document. The solution is to give the file .csv extension. If you can't change the extension for some reason, you must specify both the input and output filters (and for master it's enough to just add --calc).