LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with retrieving Excel WorkSheet List

My goal is to be able to read an excel file without opening and closing the excel application,  Not sure if this is possible...
 
I have looked at many of the excel examples but have had no luck retrieving an array list of the available worksheets in an excel spreadsheet.
 
Any help would be aprreciated.
 
Thanks
Tim C.
 
I have attached one of my attempts
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 1 of 15
(4,205 Views)

Hi Tim,

what do you mean, without opening and closeing the excel applciation? Your example use ActiveX functions and they open and close excel.
Maybe this helps: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=332299#M332299

Mike

0 Kudos
Message 2 of 15
(4,198 Views)

I know the example is opening and closing excel,  I was following an example that appeared to be opening and closing excel but the user never sees the excel app opeing and closing. 

 

Just trying steps to get some results...

 

Is it possible to handle reading the native excel file through labview?

 

Thanks

Tim C.

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 3 of 15
(4,190 Views)

Hi Tim,

to not see the excel application you can use the "visible" property node. It´s possible to read it, but you have to know the format description, to get the information you want. What do you want to do with this information?

Mike

0 Kudos
Message 4 of 15
(4,188 Views)

We have numerous spreadsheets that contain technical data on various pieces of equipment we have used throughout the years on different projects.

These spread sheets have had minor changes throughout the years i.e. a colum has been added or moved.

My goal is to be able read the spreadsheet and determine what columns I need to extract data from.  Once tha is determined I can extract the

equipment data i.e. description L, W, H, Weight, Power and BTU ratings and add them to a master list.

once the master list is created I can easily setup equipment groups and perform power, weight, and HVAC calcs.

 

Best regards

Tim c.

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 5 of 15
(4,182 Views)

Hi Tim,

as i understand it now, you have to use the ActiveX functions.

Mike

0 Kudos
Message 6 of 15
(4,180 Views)
Actually, you can also use ADO. I  had suggested this mechanism in this thread, and Mike came up with an example. If you take Mike's example and replace the opening of the recordset with a call to the OpenSchema method for the connection object (with adSchemaTables for the "Schema" input) you'll get a recordset for the sheets in the Excel file. A similar action can be done to get the column names.
0 Kudos
Message 7 of 15
(4,172 Views)

Any chance you could tell me why this is not working?

 

I was trying to get the active X read working before I tried the ADO...

 

Best Regards

Tim C.

 

 

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 8 of 15
(4,142 Views)

I got the ADO example tweaked and working for the sheet names.

 

I also tried the adSchemaColumns and it appears to be retrieving the top row with the assumption that these are colum names,  is that correct?

 

So what exactly am doing by using ADO?  Am I some how accessing the excel file as if it were a database and gaining access to the data

without the use of excel?

 

Thanks

Tim C.

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
Message 9 of 15
(4,138 Views)

@Tim C. wrote:

Any chance you could tell me why this is not working?


Simple. You're never actually opening the reference to Excel. Using text-language speakese: You've declared a variable that is of type Excel.Application. However, you've never actually opened a reference to Excel and set the variable's value. The example you copied this from had an Automation Open function. You still need that.


So what exactly am doing by using ADO?  Am I some how accessing the excel file as if it were a database and gaining access to the data
without the use of excel?


That's pretty much it. Whether or not this is of benefit to you, that's for you to decide based on your requirements.
0 Kudos
Message 10 of 15
(4,132 Views)