Xclgetdata: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Jeremy (Importing text file) |
||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Extract a data table from an Excel spreadsheet. | Extract a data table from an Excel spreadsheet. | ||
===Synopsis=== | ===Synopsis=== | ||
:xmat = xclgetdata(filename,datarange,formt) | :xmat = xclgetdata(filename,datarange,formt) | ||
===Description=== | ===Description=== | ||
XCLGETDATA extracts a data table from an Excel spreadsheet using dynamic data exchange (DDE) and writes it to the variable xdat. This function only works on a PC, the spreadsheet must be open in Office 97 or higher, and character arrays can't be extracted. | XCLGETDATA extracts a data table from an Excel spreadsheet using dynamic data exchange (DDE) and writes it to the variable xdat. This function only works on a PC, the spreadsheet must be open in Office 97 or higher, and character arrays can't be extracted. | ||
It has been observed that XCLGETDATA won't work unless a copy of the open spreadsheet is saved to the hard drive and the name in filename is exact. Also, if the function doesn't work check the Excel menu '''tools/options/general''' and ensure that the '''ignore other applications''' check box is unchecked. | It has been observed that XCLGETDATA won't work unless a copy of the open spreadsheet is saved to the hard drive and the name in filename is exact. Also, if the function doesn't work check the Excel menu '''tools/options/general''' and ensure that the '''ignore other applications''' check box is unchecked. | ||
===Examples=== | ===Examples=== | ||
To get a table data from the range C2 to T25 from the open workbook 'book1.xls': | To get a table data from the range C2 to T25 from the open workbook 'book1.xls': | ||
:data = xclgetdata('book1.xls','r2c3:r25c20'); | :data = xclgetdata('book1.xls','r2c3:r25c20'); | ||
To get a table data from 'Sheet2' the range D4 to F16 from the open workbook 'book1.xls': | To get a table data from 'Sheet2' the range D4 to F16 from the open workbook 'book1.xls': | ||
:data = xclgetdata('c:\book1.xls\sheet2','r4c4:r16c6'); | :data = xclgetdata('c:\book1.xls\sheet2','r4c4:r16c6'); | ||
===See Also=== | ===See Also=== | ||
[[areadr]], [[spcreadr]], [[xclputdata]], [[xclreadr]] | [[areadr]], [[spcreadr]], [[xclputdata]], [[xclreadr]] |
Revision as of 14:27, 3 September 2008
Purpose
Extract a data table from an Excel spreadsheet.
Synopsis
- xmat = xclgetdata(filename,datarange,formt)
Description
XCLGETDATA extracts a data table from an Excel spreadsheet using dynamic data exchange (DDE) and writes it to the variable xdat. This function only works on a PC, the spreadsheet must be open in Office 97 or higher, and character arrays can't be extracted.
It has been observed that XCLGETDATA won't work unless a copy of the open spreadsheet is saved to the hard drive and the name in filename is exact. Also, if the function doesn't work check the Excel menu tools/options/general and ensure that the ignore other applications check box is unchecked.
Examples
To get a table data from the range C2 to T25 from the open workbook 'book1.xls':
- data = xclgetdata('book1.xls','r2c3:r25c20');
To get a table data from 'Sheet2' the range D4 to F16 from the open workbook 'book1.xls':
- data = xclgetdata('c:\book1.xls\sheet2','r4c4:r16c6');