From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-07-2013 01:58 PM
How do I read data from an Excel 2010 spreadsheet with the .xlsx extension? The data I want is on one of 10 tabs in the file, I need to pick that programatically. I have the Report Generation Toolkit for LV2012, but all the vis that come with it seem geared around writing data to an Excel spreadsheet and making graphs and whatnot. I want to *read data from* an Excel spreadsheet. Searching for answers leads to a lot of "open it and save it as tab delimited text", which I can't do because I need data from the various tabs, and because this file is pretty dynamic with lots of users opening it and adding to it at various times. In order to save the tab I want as a tab delimited text file programatically, I'm back a square one, how do I open it?
Ideally my solution would fill in the blanks of: spreadsheet.xlsx---->___________________-----> 2 or 3D array of data.
thanks,
adam
Solved! Go to Solution.
02-07-2013 02:08 PM
If you need to write to Excel sheets, then you need to learn how to work with ActiveX.
tab delimited means using the tab character \t to separate values
tab in this context does not mean the individual sheets aka "tabs" of an Excel file.
02-07-2013 02:38 PM
Yes, I understand. Sheets are what I was calling tabs. I need to be able to *open* an xlsx file, which has a much more complicated format than a typical tab delimited file. The data in the .xlsx file is on multiple 'sheets', I need to access all of them. I need to know how, using the report generation toolkit 2012, to go from .xlsx file with multiple sheets, to a 3D array of data.
Adam
02-07-2013 03:00 PM
02-07-2013 03:42 PM
Well, you do have the Get Worksheet and the Get Data functions. Have you tried putting them in a loop by creating an array of worksheet indexes/names?
02-07-2013 03:52 PM
@Dennis_Knutson wrote:
Well, you do have the Get Worksheet and the Get Data functions. Have you tried putting them in a loop by creating an array of worksheet indexes/names?
Good call Dennis.
To add to Dennis post the Excel Workbook Properties.vi can be used to get the worksheet count. Wire this output to a for loop count terminal.
Ben64
02-08-2013 07:00 AM
I see these two .vis and they seem to be integral to the solution to the problem. One question: each takes a "report in" with a data type that's specific to the RGT. How do I generate a reference to a report that I'm not writing/is already written. I.e. where is "open report"? I only see "new report" to generated a report reference from nowhere.
Thanks,
Adam
02-08-2013 08:21 AM
02-08-2013 08:25 AM
Never mind, doesn't solve it. This reads from multi-sheet .xls files, but errors on .xlsx, even though a recent example.
02-28-2013 01:15 PM - edited 02-28-2013 01:16 PM
This worked for me. You just have to make sure you are parsing the correct kind of data.
"
This solves it:
https://decibel.ni.com/content/docs/DOC-3033
"