LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read data from an excel file already open by another program.

I have a LabVIEW program that performs tests and stores data into a template Excel file. In the middle of the tests, I use a seperate program for another test, that exports data to an excel file. It opens an excel file and places the data in it. Now I need LabVIEW to access this data. I would like to do it without having to save it to a file and then reading it to get the data. Is there a way to point labview to an open window to pull data? Any help would be appreciated. Thanks, Tony
0 Kudos
Message 1 of 6
(4,488 Views)

Hi,

 

This might help: http://digital.ni.com/public.nsf/allkb/99F61B6AB9CD6AFA8625734600814D6B?OpenDocument

Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(4,452 Views)

Not sure how that answers the question...

 

To OP: You seem to be asking two different questions. Your thread topic talks about reading data from a file that's already open by another program. But your text indicates that you want to fetch data that's being displayed in a window. Which is it that you want to do?

0 Kudos
Message 3 of 6
(4,445 Views)

Sorry about the confusion. And, Jeremy_B, Sorry, but that didn't help.

 

Let me try it again.

 

I have a LabVIEW program that is running, collecting data and storing it in an Excel file. When it get's to a certain point it waits while I run a seperate program that opens a blank Excel file (Book1.xlsx) and stores data into it.

 

Now, here's the situation. Next, I want my waiting LabVIEW program to get some of the data out of this Excel file (Book1.xlsx) and put it in a text file. I have the text file part of it ok. But I'm not sure if I can point LabVIEW to this Excel file (Book1.xlsx), without having to save the file first.

 

I hope this is a little bit better explaination.

Thanks,

 

Tony

0 Kudos
Message 4 of 6
(4,435 Views)
Do you ever want to save this Excel file? It sounds like you don't, and based on what you're saying then it seems as if you're just using Excel to temporarily hold this data that LabVIEW will use.This is a fairly clumsy approach, so I don't know if you have limitations/restrictions that are forcing this. If this is the case, then you will need to use ActiveX to read the data from the workbook. You indicated that your LabVIEW program performs tests and stores data into a template Excel file, so it would appear that you're already using ActiveX. Or, are you saving this in some other way? If so, then you can try the attached VI which is a minor modification to a VI I had previously posted on reading an Excel worksheet. It assumes Excel is already open and there's a workbook with a worksheet with data in it.
0 Kudos
Message 5 of 6
(4,419 Views)

You are correct. I do not need to save the Excel file (Book1.xlsx). You are also correct that this is a clumsy approach. However, I am stuck with it. The "Other" software is what opens the blank file and dumps data to it. Plus I don't need all the data that is dumped into the file. Just specific lines. As far as opening up the Template file, I am using the Report Generation Toolkit for Office to open up this template file, and saving it.

 

I'll give your VI a try and post the results next week. THANKS FOR YOUR HELP!

 

Tony

0 Kudos
Message 6 of 6
(4,413 Views)