LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue on CSV file reading

I tried to read an email data of csv file using read delimited spreadsheet ,but it causing many bugs like it leaves space in between characters, empty array between a row and mismatch data in column of some rows.

0 Kudos
Message 1 of 8
(537 Views)

Hi kuberr,

 


@kuberr wrote:

I tried to read an email data of csv file using read delimited spreadsheet ,but it causing many bugs like it leaves space in between characters, empty array between a row and mismatch data in column of some rows.


And what is your question?

 

(ReadDelimitedSpreadsheet doesn't cause those "bugs", but most probably the data you feed in.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(533 Views)

There are two possibilities:

 

  1. Your CSV file is malformed. Where does it come from?
  2. You are reading it wrong. (wrong row delimiter, wrong local decimal delimiter, etc.)

 

Attach your CSV file and the VI you are using to read it and we will tell you what's wrong.

 

0 Kudos
Message 3 of 8
(515 Views)

I guess someone have created "columns" by using space or different amount of tabs to line up the text file.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 8
(499 Views)

Copied/botted from here:

Issue on CSV file reading : r/LabVIEW (reddit.com)

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 8
(490 Views)

CSV files often contain quoted text. The quotes allow for multiline data in one field. Quoted data including a comma can be incorrectly interpreted as a new column.

 

For an example of parsing a file containing quotes and commas, try the vi in this post:

 

https://forums.ni.com/t5/LabVIEW/Read-csv-file-with-double-quotes/m-p/1591640/highlight/true#M580390

 

0 Kudos
Message 6 of 8
(462 Views)

SLL Toolkit's spreadsheet VIs support quoted strings in CSV files,

santo_13_0-1729861043335.png

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 7 of 8
(450 Views)

Well you should attach the CSV file so we can look at. 

 

If you open the CSV file in question with Excel what does it look like?

 

It should look the same as the array "Read Delimited Spreadsheet" outputs as long as you are using the correct format specifier.

 

There can be issues when reading a CSV that has both text and numbers because an array can only be one data type.

 

So if your CSV contains both strings and numerics you have to

  1. Read the CSV into a string array.
  2. Extract the rows or columns containing the numeric strings you are interested in.
  3. Convert the strings to the proper numeric data type.
  4. Put them in a separate numeric array.

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 8
(430 Views)