LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Excel data without using Read Spreadsheet.vi

I am interested in reading data from an Excel spreadsheet without using the built-in Read from Spreadsheet VI. 

 

A little background: We are setting up a basic production line and using Excel to track production information and LabView to collect QC data.  I have a workbook setup with a QC worksheet in it.  When a batch of widgets get to the QC step, a technician will assess each widget using two types of measurements.  The measurements are done with tools that are connected to a computer and can be read directly into a LabView VI.  The VI asks for the widget's ID#.  When all of the measurements are made for one widget, the technician presses a button and the data is written to the QC spreadsheet in the workbook.  However since there are multiple widgets to be measured, I need every set of measurements to be written to a new line in the worksheet.  Also, if the technician needs to re-evaluate a widget, I would like the program to see that there is already an entry for that particular ID# and to overwrite the existing data.  Lastly, there are some calculations the spreadsheet does that I may want to have the user see the results of in real time. 

 

I have worked with the basic write to Excel example that comes with LabView (v. 8.5) and though I am not very familar with ActiveX, I can basically see how I can get the data into the spreadsheet. 

 

I assume I will need to use ActiveX to accomplish all of this but if there are other suggestions I would be happy to hear them.

 

Thanks,

Corey

 

 

0 Kudos
Message 1 of 6
(5,614 Views)
The Read From Spreadsheet File and Write to Spreadsheet File work with text files, not Excel workbooks. They have been poorly named from the start, leading to years and years of confusion. If you need to work with Excel workbooks then you need to use ActiveX.
0 Kudos
Message 2 of 6
(5,606 Views)

Hi Corey,

 

If you want to read/write to an Excel spreadsheet and don't want to have to use ActiveX, you could use the Report Generation Toolkit.  It does all of the ActiveX for you.  If you are familiar with LabVIEW, this would be any easy solution for you.

 

http://zone.ni.com/devzone/cda/tut/p/id/5900

 

 

 

Justin Parker
National Instruments
Product Support Engineer
0 Kudos
Message 3 of 6
(5,583 Views)

The most robust solution is to bypass ActiveX altogether and use ADO to insert data into the file. What version of Excel are we talking here? Check here for some good ADO drivers and here for a discussion of ADO and Excel. If you are using Office 2007 also check here.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 6
(5,573 Views)

I read through the "Generating Reports in Excel" tutorial a couple of weeks ago before I started all of this and it does look like it is something we could use.  Unfortunately money is tight right now and I think I would have a hard time convincing the company to put up money for software add-on (of course the counter argument is that it would cost more in the long run to have me code it from scratch).  We are also just starting to use LabView more and I having to demonstrate its utility to people and its widespread adoption is slow. 

 

I played around with the write to Excel example that came with Labview and I was able to create a basic read from Excel function (see attached).

 

Corey

 

 

0 Kudos
Message 5 of 6
(5,527 Views)

Tip: You do not need to unbundle the error cluster to control the case structure. You can wire the error cluster directly to the case structure selector.

 

If you're going to stick with ActiveX then you will probably want to spend some time in the Excel thread

Message 6 of 6
(5,520 Views)