12-10-2008 12:14 PM - edited 12-10-2008 12:15 PM
Hi,
I will try to make it as simple as possible without confusing myself or anyone else XD.
I have attached an excel file named "Spec Sheet.xls"
Spec Sheet: The Spec Sheet itself is a file which Contains Parameters for an analzyer such as span, Video Bandwidth,Sweep Time etc. All of which can change at any given time without notice. It may also have multiple phases so labview will need to be able to read the worksheet and see that there are three phases and should be prepared to move from phase one to phase two, and finally phase three.
Goal: I want to be able to read an excel file. The worksheets specifically for example Sheet1. The idea is that instead of telling labview where my data is located i.e which cell to look at, I can have it read the entire excel worksheet and take the informtion I need without me speciifying which cell to look at. Now I am able to read the work sheet if I were to save the excel file as a text file ( Tab Limited ) and open it in labview and even display it. However I do not now how to retrieve the informtion as it will also take data which is no good to me on top of this when it comes time to update the parameters it becomes painful and it makes the folder very messy because of instead one file which have all my phases / tests you now have ten or twenty. I can do what I want by reading a the cells which contain my data exactly but this would essentially hardcode my labview code so if I were to add a new phase to a work sheet it would have to be added in the labview code itself. I would like for the labview code to be able to read the worksheet see that there are X number of phases and retieve the information as labview finishes sending the parameters to the analzyer.This would allow me to add as many phases as possible without updating the labview code with the locations of the phases / tests.
Problem: The problem is I don't know how to do it. I can do single cells in a worksheet and get my data but reading an entire worksheet then having labview determine where the valued data is diffcult or impoosible. The only way way I can think of really is to have labview look at a cell which says there are X number of phases then have labview look for Phase 1, Phase 2, Phase 3 etc. Then have it look at Phases in order and inside each phase have a tag which says the data is the next cell over.
if there is any confusion let me know and I will try to clear things up. I have tried looking at the excel board and I have a vi which reads the excel file but its labview 8.6 and I only have labview 8.2
12-10-2008 07:03 PM
12-11-2008 10:41 AM
Trager wrote:
In my opinion, this is one of those cases where it's nice to have some additional programming skills aside from LabVIEW. The easiest way to do what you want is to write a quick VBA script that parses the first worksheet to see which worksheets are active, and then iterates through those sheets to find valid columns, most likely based on keywords. Although you can access any of the VBA properties and methods through the LabVIEW ActiveX interface, it is extremely onerous and somewhat clunky. Much better to write the routine natively in VBA and then just call it from LabVIEW, with the results either placed in a reserved spreadsheet cell or copied directly to the clipboard.
What if I were ti pull up all the information directly onto labview i.e. read the worksheet and store it in a readable file for labview would what I am trying to achieve be more sensible that way? If so any suggestions?