LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Input Into Labview from Excel in real-time

Sam,
  Thanks for the VI. I actually already tried this VI, and it turns out that it works fine for loading data from excel when the file has been saved. However, when data is being imported into Excel in real time, the process becomes more difficult because the user would have to periodically save the file, as often as possible. This is not very practical, and will not work for my application. I am still looking for a VI that may work, preferably one that does not require excel to save periodically.
  Thanks for your help.
    David
0 Kudos
Message 11 of 22
(2,158 Views)
Hi David,

I modified this example a little bit and attached it.

It worked great for me. Basically, I just made excel visible and put the code in a loop such that it would repeatedly read from any given cells. To test it out, select the path to your spreadsheet. Then, while it is open, change the values of the selected cell in LabVIEW (e.g. A1). As soon as you hit enter in Excel, LabVIEW detects and updates with the correct value.

Does this work sufficiently for your application? Or if it doesn't, why not?

Best regards,
-Sam F, DAQ Marketing Manager
0 Kudos
Message 12 of 22
(2,146 Views)
Sam,

 Thank you very much for the VI. Unfortunatly, I have labview version 8.0, can you save it for a previous version for me?

The way you describe it, it seems like it would be ideal. I have to test it though.

In the meantime , I found a VI which reads a cell value in one case of a stacked sequence, and in the next, saves the excel file. I havent fully tested this VI but it seems like it would work, albeit poorly. This is better than nothing, however, your solution may be much better. I have to see. Again, thank you so much for your help.

Best,
 David
0 Kudos
Message 13 of 22
(2,144 Views)
Hi David,

Repetitively saving it may work, but it is a lot of additional File I/O which is of course quite slow.

I've attached the VI in 8.0, let me know how it works - and have a great weekend!
-Sam F, DAQ Marketing Manager
Message 14 of 22
(2,143 Views)
Sam,
 I just tested the vi, and I couldnt be happier. This works better than I could have ever expected; there is virtually no lag in performance so far. Obviously this VI is much better than my other alternative. Thank you so much!!! I would be more than happy to put in a good word for you to your manager, etc. Again, thanks so much.

 I will let you know on Monday if there are any problems after I make extensive testing, but it seems like there shouldnt be a problem.

Have a great weekend!
 David
Message 15 of 22
(2,137 Views)
hey Sam,
i had a problem very similar to David's, infact almost the same.
i have to measure vibration using a Hardware that already had a built-in DAQ which connected to USB port and used it's own s/f. The S/f can export the data(graph) to Excel... but the data used to be continously updated and i could read only the values at the timing of saving the spreadsheet and not the updated values.And my knowledge of ActiveX is zilch. I had posted a lot of times on the forum but never found a solution until now.

had almost given up until i came across the VI you made for David...It's perfect..just wat i have been looking for a looong time.
THANX a lot!

BTW,In the program you have given,only one cell is read at a time... is there anyway i can modify to make it read more than a cell( say, A1 to A15) at a time.Each of these cells are continously updated. i'm rather new to LV and can't figure out how to do this own my own!
ne way thanX a lot...
thanx to David too..

DiPS


Message Edited by DiPS on 04-23-2007 05:35 AM

0 Kudos
Message 16 of 22
(2,124 Views)
Hi DiPs,

Sure. Basically, you'll only need to modify two things: the cell range inputs, and change the data type going into the "Variant To Data" Function. I modified the example to accept a 2D array, though if you only wanted a 1D array you could change the input to "Variant To Data" to be of type 1D array of double.

See attached.

Best regards,
-Sam F, DAQ Marketing Manager
0 Kudos
Message 17 of 22
(2,114 Views)
hi Sam,
ur gr8..just what i wanted... but just one thing...as you have mentioned i just need a 1d array... how do i change the input to the variant to data to be 1d?
neway thanx a lot
DiPS

0 Kudos
Message 18 of 22
(2,096 Views)
Glad to have helped.

All you'll need to do is change the data type going into variant to data. To do this, simply contract the initialize array function such that it has one fewer input, and it will then yield a 1D array rather than a 2D array. This will break the output indicator, but you can just delete it and create a new one.

Best regards,
-Sam F, DAQ Marketing Manager
0 Kudos
Message 19 of 22
(2,090 Views)
Hey Sam,
 
you have been a great help...thank you........ one last question and i won't bother you anymore (hopefully)!
 
i'd like to compare the values i get from the cells against a constant threshold.
 
if only one cell is read,as in the initial vi you made, this is easy as i just have to use a Compare arithmetic operator within the loop and compare the input cell data with the threshold each time the cell is updated.
 
but what if there are more cells read and updated at a time, as in this case and i want all of them compared against the threshold.... ok so if there are 4 or 5 cell i can probably use an index array,get each of the values seperately and connect each of them with a compare operator.
 
however this won't be practical if i am going to read 100 or 500 cells at a go and i want to compare the values coming from each of the sprdsheet cells against the threshold. hope i made my question clear..
 
anyway thanx for all the help you have already given
DiPS
0 Kudos
Message 20 of 22
(2,072 Views)