LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with the "Read Delimited Spreadsheet VI"

Solved!
Go to solution

Hello,

 

I try to read a csv file with LabVIEW. 

 

This is my VI for reading the csv file:

Michael_1122_0-1631519208756.png

 

This is the ";" delimited csv-file, which I want to read:

 

Michael_1122_2-1631519450003.png

This is what I get:

Michael_1122_3-1631519508500.png

 

As you can see, there is a "0" in the first column and first row.

 

Does anybody know what causes this behaviour?

 

Thank you very much in advance.

 

Best regards,

Michael

0 Kudos
Message 1 of 11
(3,317 Views)

Hello Michael,

 

I assume there is an (or several) additional character(s) at the start of your file.

 

For further analysis either upload the file or look at it in binary form.

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 2 of 11
(3,308 Views)

Hello Jens,

 

thank you very much for your quick reply.

 

I attached the the file to this reply.

 

Best regards,

Michael

0 Kudos
Message 3 of 11
(3,304 Views)
Solution
Accepted by topic author Michael_1122

Hi Michael,

 

as Jens told you: there are some additional bytes at the beginning of your file!

You probably edited that file using a text editor (like Notepad) instead of creating it directly from Excel…

 

See this view of your textfile using a hex viewer:

The first 3 bytes are used to determine the UTF status of that text file. LabVIEW doesn't handle those bytes explicitely and when reading a delimited text file it tries to convert that file content like any other file content…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 11
(3,287 Views)
Solution
Accepted by topic author Michael_1122

Your file contains a three-byte Byte Order Mark (BOM) declaring that the file is encoded in UTF-8. In this case, it's a useless information since all characters are ASCII. LabVIEW does not support BOMs anyway.

You may set your editor options to avoid writing the BOM. As an alternative, open your file with Notepad, then choose Save As... setting ASCII as encoding options. See below (doing a little translation to your language):

 

pincpanter_0-1631525724114.png

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 11
(3,279 Views)

@pincpanter  ha scritto:

 As an alternative, open your file with Notepad, then choose Save As... setting ASCII as encoding options.


I meant ANSI, not ASCII...

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 11
(3,272 Views)

I think Notepad will make some guesses according to your localization.  I think that it will add BOM if you have non-English localization?  Something along those lines?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 11
(3,252 Views)

@billko  ha scritto:

I think Notepad will make some guesses according to your localization.  I think that it will add BOM if you have non-English localization?  Something along those lines?


Not always. If I create form scratch a file with non-ASCII-standard characters, Notepad generates a UTF-8 file (i mean with multi-bytes characters), but does not prepend a BOM.

Honestly, all this character representation stuff is often a mess to me.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 8 of 11
(3,241 Views)

@pincpanter wrote:

@billko  ha scritto:

I think Notepad will make some guesses according to your localization.  I think that it will add BOM if you have non-English localization?  Something along those lines?


Not always. If I create form scratch a file with non-ASCII-standard characters, Notepad generates a UTF-8 file (i mean with multi-bytes characters), but does not prepend a BOM.

Honestly, all this character representation stuff is often a mess to me.


Yes, I'm not sure exactly how it works, either, which is why I avoid working with Notepad.exe if at all possible.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 11
(3,227 Views)

Hello GerdW,

 

you were right. Thank you very much for your reply.

 

Best regards,

Michael

0 Kudos
Message 10 of 11
(3,194 Views)