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 strings from excel

Dear members,
How to read strings from excel file using read from spreadsheet file.vi, when i tried to read strings it displays only 0.
thank you
sasi

0 Kudos
Message 1 of 14
(4,338 Views)
Hi sasi,

What kind of excel file are you trying to read ?
The "read from spreadsheet fil.vi" is made to read numeric text files. Depending on what you have in your excel file it might be easier to use the "read file.vi" or "read characters from file.vi".

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 14
(4,330 Views)

Hiii,Sasi

        As per your statement un the post i think that in your excel file, there is a data is as a string, and it is tab delimited file, so if you try it through the Read from spreadsheet file, then you won't succeed, you use the open file/read file and close file, whic gives you data, perfectly. Is there any string in the excel file???? thats waht dont allow you to read the data from spreadsheet , coz it reads the numerical data.

Thanks,

Nishant

0 Kudos
Message 3 of 14
(4,325 Views)

Hi

If you want to read a "real" excel file, I mean a file that was saved with excel, you can't read it using "read from spreadsheet file", because it is binary.

As TiTou already pointed correctly, this function just reads files, that were stored character separated and that just contain numbers.

To read a binary xls-file, I think you have to use ActiveX. There were already some discussions about how to retrieve data from a xls-file.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 4 of 14
(4,325 Views)

Hiii, Thomas

           Here as Sasi told that there is a string in the excel file, then it easily can be read by using the read file,it is to simple to read this way, i dont think that he should go for the Activex, cos i already have read the excel files with the strings, and it gives me the perfect result. and according to Sasi's post, i think that his file should be tab delimited.

          Here i ve attached the vi, in path just enter the file, .xls with strings and it will read the data and give it to the Data.

Thanks,

Nishant

0 Kudos
Message 5 of 14
(4,319 Views)
Nishant
 
Yes, the string itself is readable, but there is no secure way to determine which string you are reading. Additionally, if you want to read some kind of table, I don't think that it would work.
 
If you could proof the opposite, I'm very interested in the solution.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 6 of 14
(4,316 Views)
Hiiii, Thomas,
 
            First of all i am sorry for not attaching the vi, which i ve written in last, i forgot that, and another thing yes, any of the table can be readable throug this method, and for the statement "but there is no secure way to determine which string you are reading", you can do one thing that you can put the tab, while reading the data, which will seperate teh line.
 
        Here just give the excel file with the string in the path, and you could see the data in the vi and to seperate the data, you have to put the tab seperator, hey sasi  can you do one thing please post your excel file with the string, so that i can format my vi.
 
Thanks,
Nishant
0 Kudos
Message 7 of 14
(4,310 Views)

Obviously we're talking about two different things.

In a excel-file you can't "put the tab separator". So I attach you a simple excel-file, which I'm quite sure you can not read in and display it in a proper way.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 8 of 14
(4,307 Views)

Hiii, Thomas,

            I already worte in my previous post that i was talking about the tab delimited file, and thats why i was talking about putting tabs in the vis while reading the tab delimited file, so it might my misunderstanding in this point, anyways thanks man, nice conversation with you.

Thanks,

Nishant

0 Kudos
Message 9 of 14
(4,301 Views)
So for the next time maybe we could agree to talk about a tab delimited or csv-file and about an excel-file in separate ways. 😉
 
I overread the tab delimited file in your first post, but as you saw mixing up excel-files and csv-files causes problems, because an xls-file is basically not a csv-file (although I assume that lots of LV users cheat and just write a csv-file with an xls-ending 😄 - including me).
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 10 of 14
(4,299 Views)