From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read datas from Spread Sheet?

Hi Friends,I had created one Spreadsheet file. In that i had lot of integer values. I ve to read the integer values from a spread sheet.. How to do it?

 

I am new to this environment.Please help me out

0 Kudos
Message 1 of 10
(3,431 Views)

Hi deepak.aamecece,

where do you have problems with your vi? Are you using "Tab (\t)" as delimiter in your spreadsheet file? If not, then you should change it to the delimiter you use.

 

Mike

0 Kudos
Message 2 of 10
(3,415 Views)
Can you attach the file that you are trying to read?
0 Kudos
Message 3 of 10
(3,407 Views)

Hi Friends,,, I got the answer... One surprice thing i noticed. I had written code to read datas from spreadsheet file. The code was executed and i got the answer correctly in Vista OS. But the same code was copied and run in another system which is run by Windows XP OS. The problem is I couldn't get the answer in the second system.Why is it so? I was very surpriced....

 

I attached the screen shot of my program...

0 Kudos
Message 4 of 10
(3,392 Views)

Hi deepak,

 

how should we know when you don't attach your "spreadsheet file"???

 

Also "The problem is I couldn't get the answer..." isn't a very clear error description!

Message Edited by GerdW on 05-12-2010 12:58 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 10
(3,377 Views)
I dont know whether the screen shot shows your expected result or not. What are you trying to read and what is the problem? Also you are trying to read excel using spread sheet functions. Is the excel created by write to spread sheet?
0 Kudos
Message 6 of 10
(3,366 Views)

Are you actually trying to read an Excel spreadsheet file (your screenshot shows an .xls extension)?

 

Write and Read Spreadsheet File VI's do not work with Excel files, only text files that are formatted in a spreadsheet-like format with delimiters and end of line characters.

 

If you file is actually a text file, then you shouldn't name it .xls because it is not an Excel file.  It should be named with a .txt, or .csv, or something else.

0 Kudos
Message 7 of 10
(3,348 Views)

Hi Friends... I got your point... 

 

This is the first step i did...Actually i had created a .xls file using MS Excel Manually(Manually i sense created us MS office function not thro labview program). i had pushed some numerical datas while creating it.

 

Second Step:

 

Then i had written code in labview to read the datas what i pushed in it. Eventhough the code i had written correctly i couldn't retrieve the datas from  excel sheet using Read from Spreadsheet.vi function..I couldn't undrstand why is it so?

 

Third step:

 

Then i created that file using function in labview and pushed datas to that file using labview too. then only i can read dats from the dats using  Read from Spreadsheet.vi function..

 

Finally i got the answer for my application  need friends...

 

 I am having one doubt. I am creating one txt file manually. i.e using notepad. I used the same function "Read from Spreadsheet.vi" in labview. this time this function retrieves numerical datas correctly at first time itself without requiring third step as i mentioned above. For this i am not forced to create that file (.txt) using functions in labview. Moreover Labview function read only  first column values. couldn't read the row datas..  My Question is: Why this happens for txt files? Are you got my point?

 

I had attached screenshots and xls file for your reference..Thank you one and all for ur response..

Download All
0 Kudos
Message 8 of 10
(3,319 Views)

Hi deepak,

 

this has been asked numerous times before and always have been given the same answer:

A xls-file is not the same as a spreadsheet file! A xls contains (among other things) also spreadsheet data, but it isn't a spreadsheet file...

 

If you would open the xls generated with LabVIEW you would see that it is actually a simple txt file - the only point is it contains data as "tsv" (tab seperated values). Just because you name something xls it doesn't become a proper xls file...

 

To read data from (real) xls files you need to use ActiveX, also often to be found in the forum. To easily distribute data to Excel use csv or tsv formatted textfiles...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 10
(3,300 Views)
Thank You Mr.GerdW
0 Kudos
Message 10 of 10
(3,290 Views)