Transfers a range of values to Excel via ActiveX Automation.
XLPUT("rangestr", value, "bookname", sheet)
"rangestr" |
- |
A string. The Excel cell source range. Defaults to "A1", the first cell. |
value |
- |
A series, string or scalar to transfer. |
"bookname" |
- |
Optional. A string, the Excel Workbook name. Defaults to "" (empty) indicating use current Workbook |
sheet |
- |
Optional. An integer or string, the Excel Sheet number, or sheet name. Defaults to 1, the first sheet if "bookname" is specified, else the current sheet. |
A 1 if successful, else an error.
W1: rand(10, 3)
xlput("A1:C10", W1)
W2: xlget("A1:C10")
W1 == W2 is all ones, that is W1 and W2 are equivalent. The data is transferred to the current Sheet of the current Workbook.
W1: rand(10, 3)
xlput("A1", W1)
W2: xlget("A1:C10")
Same as the previous example except only the starting destination cell is specified. The complete destination range is determined automatically.
W1: rand(10, 3)
xlput("A1:C10", W1, "Book2", 2)
W2: xlget("A1:C10", "Book2", 2)
W1 == W2 is all ones, that is W1 and W2 are equivalent. The data is transferred to the second Sheet of Workbook Book2.
xlput("A1:C10", {});
Clears the values in the range A1 to C10.
xlinit("C:\my documents\dsp.xls")
xlput("A1:C10", rand(10, 3))
Cells A1 through C10 in the XLS file "C:\my documents\dsp.xls" contain normally distributed random values.
If Excel is already running, XLPUT attempts to connect to the running instance of Excel, otherwise XLPUT connects to a new instance of Excel.
If the specified target range is only one cell, the full range to accommodate the data is automatically determined.
Numeric data is transferred as variants containing double precision or date/time values.
Setting a range to an empty series {}, clears the range.
See XLINIT to open a specific Excel Worksheet file.
See XLGET to obtain data from Excel.