开发者

OpenOffice Calc can not read a simple CSV file. Why?

I have a Web site (PHP) that generates a CSV file (text/csv) with the following content:

ID;E-Mail_User;Name;Applikation;Rolle;Auftragsdatum;Administrator
522;user@domain;WXDUILAS;ABCD;XYZ;2009-03-04 05:00:09;user@domain

When I select OpenOffice to show the CSV file only an empty spread sheet is shown. No error is displayed. When I try to open the file with oocalc test.csv the same happens. I have tried different versions of OpenOffice.

What is wrong with the file? How can I get an error message out of OpenOffice?

Update: It does not have anything to do with the use of semicolons. I have reduced the file to 4 charaters. A file 开发者_如何学Cwith the contents ID;A opens the CSV import dialog. But a ID;E opens an empty sheet. Why?

Update 2: The pattern id;E also works. ID;E must be some kind of magic code. Does anybody know the meaning?


ID; in the first 3 characters of a file is the signature for a SYLK file. The fourth character can be a P, N or an E which flags certain information about how the rest of the file should be processed... so your "CSV" file is almost certainly being parsed as a SYLK file when that initial signature is read, and the remainder of the file is not valid SYLK format.


CSV means C omma S eparated V alues, which is not what your document contains.

Those are semicolons.

If possible, change the PHP code to generate this instead (which is actually CSV):

ID,E-Mail_User,Name,Applikation,Rolle,Auftragsdatum,Administrator
522,user@domain,WXDUILAS,ABCD,XYZ,2009-03-04 05:00:09,user@domain

...or specify ; as the delimiter using the Text Import dialog.


Add space after ID (i.e. "ID ").

Not the perfect solution but worked for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜