LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Delimited Spreadsheet.vi reading all zeros

Solved!
Go to solution

Hello everyone. I am having trouble with the Read Delimited Spreadsheet.vi reading a simple spreadsheet. The array it reads turns up all zeros with a few random numbers here and there. I'm sure I'm doing something dumb but this previously worked on another VI where I created data in LabVIEW, send it to a spreadsheet with the Write Delimited Spreadsheet.vi, then later imported it back into LabVIEW with the Read Delimited Spreadsheet.vi. That works just fine.

 

However, when I manually create a spreadsheet and attempt to read it...no luck. Converting the data into a text file/.csv works but I would like to be able to read it from a spreadsheet. Thank you.

Download All
0 Kudos
Message 1 of 11
(3,221 Views)
Solution
Accepted by topic author Kastun27

Hi Kastun,

 


@Kastun27 wrote:

Converting the data into a text file/.csv works but I would like to be able to read it from a spreadsheet.


A "spreadsheet file" is something completely different than your proprietary Excel XLS file!

"Spreadsheet" files usually are called "CSV files" aka "delimited text files"!

 

ReadSpreadsheetFile CANNOT read Excel XLS(X) files: you need to use RGT functions instead!

(Or use Excel to write your data into a CSV file…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(3,220 Views)

Ahh ok. I should have known that. I really need to start asking you guys before spending two hours trying to solve problems like this.

 

The version of LabVIEW I'm working with does not have the RGT. The guy who had this project before me appended .xls to the csv file then just dealt with the error message when opening it up in Excel. 

 

I can just pull the data from a delimited text file.  Thanks again. 

0 Kudos
Message 3 of 11
(3,186 Views)

Do you know of a method to "comment out" in the text file in this situation? So that instructions can be added that LabVIEW will not try to import? 

0 Kudos
Message 4 of 11
(3,159 Views)

I am having a smilar problem, but I have been reading a .csv file from the outset. I have the deliminter set to comma. The first row of my data are the headers (Time and Channel 2(0)). Each subdequent row is the numeric data.

 

If I set the polymorphic instance to 'String', I have no problems. But if the polymorphic instance is set to 'Double', I just get all zeros.

 

Thoughts? 

Chris

0 Kudos
Message 5 of 11
(3,069 Views)

Hi crsbrs,

 


@crsbrs84 wrote:

I have the deliminter set to comma. The first row of my data are the headers (Time and Channel 2(0)). Each subdequent row is the numeric data.

If I set the polymorphic instance to 'String', I have no problems. But if the polymorphic instance is set to 'Double', I just get all zeros.

 

Thoughts? 


Thoughts on what exactly?

You wrote there are "no problems" when you use the "strings" instance: use it to read the delimited file including the header row…

 

(Otherwise attach your VI and an example CSV file to explain your problem.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(3,062 Views)

Sorry, should have been more descriptive in the first place... 

 

I attached the type of .csv file  I want to read into LabVIEW and the VI that I am using. Essentially, I want to read all of the data in columns one and two minus the first row (the headers). I figured that once all of the data is read in, I could just delete the first row later (hence you won't see this step in the VI)

 

I was following along with a tutorial (https://www.youtube.com/watch?v=e0cnmZbmDOk&ab_channel=Let%27sTeachScience) and it looks like I have an idential VI, but my output array is all zeros... 

 

Does that help?

Chris

Download All
0 Kudos
Message 7 of 11
(3,056 Views)

Your values are surrounded by quotation marks.  So change your format to be "%f" (yes, include the quotation marks).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 11
(3,047 Views)

Have you tried to run this? I did and it did not work for me. 

0 Kudos
Message 9 of 11
(3,039 Views)

I think was GerdW is wondering (as am I) is what is the problem with using the string output instead of numeric? 

 

But in any case, you could always output as a string and convert to numeric if needed. I have attached the altered VI and also used delete from array to remove the headers. 

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