LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read dates from Excel files

Hello everybody!

 

I have a problem reading dates and maybe you could help me.

 

I am making a program which reads data from Excel files. For doing that I have used a library which was published in this forum by Jarrod S (the name of the post is "read xls file"). Using one of these VI I can read strings, numbers, arrays of strings and arrays of numbers.

 

However if I try to read a date (9/02/2008 or 2-Sep)  written on one cells of the XLS files (using the VI in reading strings mode) and  I get a number, instead of the string of the date.

 

What I have seen (I don't know too much about Excel), it seems like if Excel uses a kind of mask so you can be the date in the normal way (02-Sep) but actually it 's saving a number.

 

What I want is to get the string of the date (9/02/2008 or 2-Sep), or maybe get the formule to convert that number into a "real" date.

 

Thank you very much!!

0 Kudos
Message 1 of 3
(2,838 Views)

Hi 1000a,

you can read your date as string. You should connect a string to the "variant to data" function istead of a numeric.

 

Mike

Message Edited by MikeS81 on 02-20-2009 11:54 AM
0 Kudos
Message 2 of 3
(2,834 Views)

Thank you, MikeS81.

 

I have tried to do what you have told me, but it doesn't work either.

 

Let me explain what I have done.

 

I use the VI Get Excel Values (modified to received just one string). If I put in this point a string control I can see the number associated to this string. Then I have the variant to data function, and after that another string control.

 

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 the library, they use ActiveXclass (or something like that). So what I have to do?Create a class with the convertion (number to data string) or is something simpler (I hope so).

 

Thanks again,

1000a

0 Kudos
Message 3 of 3
(2,810 Views)