Showing results for 
Search instead for 
Did you mean: 

read xls


Hiii, Jarrod,

            Thanks for the help first of all !!!, but there is an error in my program when i was trying to read the data from the excel file Smiley Sad and the error was"The remote procedure call failed.  in>Get Excel" 

             I think this error generates bcoz of my file is in the text format with the delimited tabs, and the program is for .xls extension but not any other types, so is there any solutions for that??? i want it urgent.

Thank you,


0 Kudos
Message 11 of 24

Hi Rujuta,

If you are using tab-delimited text files rather than Excel files, then you can just use a VI in the LabVIEW File I/O palette called Read from Spreadsheet Just click the search button and type spreadsheet if you have problems finding it. There's no need to automate Excel to read a plain old text file. Keep in mind: automating Excel is SLOW (all things considered 😉 ).

Jarrod S.
National Instruments
0 Kudos
Message 12 of 24

Hi Rujuta,

Start here for more information on saving VIs in llbs.

Jarrod S.
National Instruments
0 Kudos
Message 13 of 24

Hi Jarrod S

This is exactly what I want to know. I'm a bit behind the times using 7.0. Can you explain the data type of a range? I want to read just one part of the excel spreadsheet and I don't know how to specify the range. This gem is hidden in your no doubt excellent program.

Yours SIncerely


0 Kudos
Message 14 of 24

Please look at the LV example called Write Table to XL.  It demonstrates how to write a tabel of data to a worksheet by addressing individual cells.  Just convert the Range_>Value2 write to read and you can get the data from the cell.  The Value returned is a variant,so  you need to convert to either a string or a double, depending on your data type with the Variant To

If you want to address specific cells there are 3 choices for specifying a Range.  1) Use the example VI to convert Row and Column to the A1 format.  2) Specify the A1 format using string formatting (watch out for Z, AA)  or 3) Use a Named Range.  By defining a specific name to represent a cell or group of cells, you can bypass the string formatting altogether.

The VBA code for reading the cell is Result = Application.Sheets(1).Range("MyCell").Value2

Michael Munroe, CLD, CTD, MCP
Automate 1000+ VI Search and Edit operations with Property Inspector 3.2, now with Global Exclusion™ and Persistent Selection™!
Review the top 24 Impossible with LabVIEW Categories
Message 15 of 24
That library rocks.  Do you have any examples for writing 2D data?  Thanks!
0 Kudos
Message 16 of 24
Thanks Frank!

I don't believe I have any examples, but you can modify the GetXL_CellValues VIs very easily to make a version that writes instead of reads. It will be almost identical. Check the pic below to see how to modify one of the Reads to make it a write instead.

Message Edited by Jarrod S. on 06-27-2007 12:20 PM

Jarrod S.
National Instruments
0 Kudos
Message 17 of 24
I took your advice after  I made that post.  I actually modified that sub like you did and use it in your "Get Excel Values" VI.  But now of course it writes.  Thanks for the reply and I may be getting back to you for any questions.  I've used LabView  for years but am new to active x.  Its pretty cool!  Again, I am glad I stumbled across your library.  I was setting one cell at a time until I saw your range method.......
0 Kudos
Message 18 of 24

Hello everyone!!


First at all, I would like to thank Jarrod for the GetExcelValues.llb because it has been really useful for the program I am trying to develop.


However, now I have a problem with this software: when I try to read dates from Excel files, instead of get a string (like 2-Sep or 9/02/2008) I get a number. What I have seen (I don't know too much about Excel), it seems like Excel uses a kind of mask so you can see the date in a normal way (2-Sep) but actually it is saving a number. This is the number that I get. Nevertheless, what I would like to have is the string of the date.


So far, I am using the following blocks: the VI, Get Excel Values (modified to received just one string), a string control (which lets me see that the read data is the number associated to the string). After that, and following  MikeS81's advice, I have put the variant to data function, and after that another string control. So both string controls show me the same result.


I suppose that problem is that I don't have anything in the "type" input, but I don't know what I have to put. Watching the examples of Jarrod's library, I should use ActiveXclass (or something like that).What exactaly do I have to do?Create a class (activex) with the convertion (number to data string) or is something simpler (I hope so).


If I had to create a Active X class, could somebody tell me:

1-.How to do it?

2-.What the formule that I have to use to convert data form a number to a date string.


Thank you very much






0 Kudos
Message 19 of 24

Yes.  Dates in Excel are just a number.  The formatting of the field is how it shows up as a meaningful data to you when you view it in Excel.  The number is the number of days since 1/1/1900.


LabVIEW dates are also inherently a number.  They are the number of seconds since 1/1/1904.  Search the forums for lots of different examples on how to convert.

Message 20 of 24