CSV questions

mrtweaver

Member
Join Date
May 2007
Location
Bloomsburg
Posts
329
Attached please find 2 CSV files. One called emp2.csv (this one was created using Excel) and emp2a.csv (this one was created using Python programming). The problem I am having is that the PLC I am using, The Horner NX221, will read the file created using Excel but it will not read the file created using Python. I have done everything I can think of to compare these files. I have added as you see in the one and end of file marker, both files had it at one point. I have used Notepad, Word, Excel, DOS command 'Type', and everything I have tried so far has said that these 2 files are equal. So I am asking for a fresh set of eye(s) to look at these 2 files and see what they can see as to why one would work and one wont. THanks for any and all assist. Have a great day.
 
Loading both into Ultracompare, shows that the emp2.csv file has an extra 5 bytes appended at the end.
First, a CR/LF pair, then hex 1A, then another CR / LF.

Actual bytes are 0x0D 0x0A 0x1A 0x0D 0x0A

Also, if you look at the actual file sizes (properties), emp2 is 319 bytes, emp2a is 314 bytes.

--- Edit

Looking at other Excel generated CSV files, it seems they all end with at least a CR/LF (0x0D 0x0A) pair. Also, for the record, The General CSV specification requires that every record be terminated by a newline, so either CR/LF or just LF.
 
Last edited:
So what you are saying is that the one eof that I put in added the 1a the cr and the lf. would this be correct?

I just assumed that the eof added the extra 5 bytes. Maybe I thought wrong. If you are looking at both files is there any difference between the number formats? SUch as is there a cr or lf between each number sequence or is the difference you mention here the only one?

Thanks for looking at them. If you dont mind my asking is this Ultra compare part of windows or an additional program?

Thanks again.

rdrast said:
Loading both into Ultracompare, shows that the emp2.csv file has an extra 5 bytes appended at the end.
First, a CR/LF pair, then hex 1A, then another CR / LF.

Actual bytes are 0x0D 0x0A 0x1A 0x0D 0x0A

Also, if you look at the actual file sizes (properties), emp2 is 319 bytes, emp2a is 314 bytes.

--- Edit

Looking at other Excel generated CSV files, it seems they all end with at least a CR/LF (0x0D 0x0A) pair. Also, for the record, The General CSV specification requires that every record be terminated by a newline, so either CR/LF or just LF.
 
Textpad is the bomb as well.

Eddie Willers said:
Ultracompare is the cousin of UltraEdit, probably the niftiest programmer's text editor on the market.

www.ultraedit.com

I also use the open-source WinMerge for file comparison, but UltraEdit and UltraCompare are very solid tools for better programmers than I.
 
Well, 0x1A is not an EOF character, if that is what you meant. There actually is no EOF character. EOF is handled by the operating system. There is an EOT character, and an ETX character, but that doesn't matter here.

The fact that your device won't read the file output from the Python program is most likely due to it NOT having a CR/LF or an LF as it's final character, leaving the device to wonder if it has a complete record or not.

No, byte for byte, every bit between the two files is identical, except for the add 5 characters at the very end of the Excel file.

Also, Much love for UltraCompare 32. It's about the best diff utility I've ever used.
 

Similar Topics

Good morning, I have a Emerson/GE PLC with Cimplicity SCADA. I need to export data of a specific point/object to a CSV file and load the CSV file...
Replies
7
Views
211
I am trying to import addresses and symbols from a PanelBuilder32 application into the RSLogix 5 Address/Symbol database - however each time I...
Replies
5
Views
503
Hello guys, Im using a siemens with WINCC in a computer and need to import to tag´s data fom a specific row in a SCV file, i have a working...
Replies
15
Views
1,559
Hi. About 18 months ago a did a CODESYS project using the CSV Utils from the IIoT libraries. I am trying to reuse what I did and it does not...
Replies
1
Views
362
Hi Everyone, I am hoping a Red Lion Expert can point me in the right direction. I am experimenting with data logging on a CR3000 10" screen...
Replies
4
Views
574
Back
Top Bottom