ExcelRead3ΒΆ
ExcelRead3 reads MS-Excel files (.xls).
-
smMatrix = ExcelRead3(ssFileName)
-
smMatrix = ExcelRead3(ssFileName, ssSheetName)
-
smMatrix = ExcelRead3(ssFileName, nSheet)
-
<smMatrix, rmType> = ExcelRead3(ssFileName)
-
<smMatrix, rmType> = ExcelRead3(ssFileName, ssSheetName)
-
<smMatrix, rmType> = ExcelRead3(ssFileName, nSheet)
-
<smMatrix, rmType> = ExcelRead3(ssFileName, ssSheetName, hStatusWnd)
-
<smMatrix, rmType> = ExcelRead3(ssFileName, nSheet, hStatusWnd)
-
<smMatrix, rmType> = ExcelRead3(ssFileName, ssSheetName, hStatusWnd, nOption)
-
<smMatrix, rmType> = ExcelRead3(ssFileName, nSheet, hStatusWnd, nOption)
-
<rmData, smString, rmType> = ExcelRead3(ssFileName)
-
<rmData, smString, rmType> = ExcelRead3(ssFileName, ssSheetName)
-
<rmData, smString, rmType> = ExcelRead3(ssFileName, nSheet)
-
<rmData, smString, rmType> = ExcelRead3(ssFileName, nSheet, hStatusWnd)
-
<rmData, smString, rmType> = ExcelRead3(ssFileName, ssSheetName, hStatusWnd)
-
<rmData, smString, rmType> = ExcelRead3(ssFileName, nSheet, hStatusWnd, nOption)
-
<rmData, smString, rmType> = ExcelRead3(ssFileName, ssSheetName, hStatusWnd, nOption)
Return Value
smMatrix contains the data of an Excel spreadsheet as a string matrix. If an
error occurs, smMatrix is a scalar string ("Error"
) and smType contains
the value 999. rmData is a real matrix. A matrix element is valid if the the
corresponding type matrix (smType) element has the value 0 or a value smaller
than 100 depending on the parameter nOption.
smString is a string matrix. A matrix element is valid if the corresponding type matrix (smType) element has the value 2 or 100 depending on the parameter nOption.
rmType is a real matrix. The elements contain the data types of the corresponding spread sheet cells.
If called without the the parameter Option the elements have the following value:
Value | Description |
---|---|
0 | Number |
2 | String |
3 | Empty cell |
If nOption has the EXCEL_DETAILED_FORMAT set, the type elements contains information about the cell format:
Value | Description |
---|---|
0 to 10 | Number, value is number of decimals. |
19 | Number, format undefined (General). |
20 | Number, time format e.g. 12:17:32. |
21 | Number, date format e.g. 02.30.2009 |
22 | Number, date-time format. 02.30.2009 12:17:32 |
100 | String |
101 | Empty cell |
999 | Error occurred |
Parameters
-
ssFileName
ssFileName is the name of the Excel file, i.e.
"c:\\excel\\test.xls"
orc:/excel/test.xls
.
-
ssSheetName
ssSheetName is the sheet name of the Excel 5.0 file. If this parameter is not specified, the first sheet will be read.
-
nSheet
nSheet is the sheet index of the Excel 5.0 file. If this parameter is not specified, the first sheet will be read. Default value is 1.
-
hStatusWnd
Is the handle of the status bar window. It is used to display processing progress (default is 0). The AppGetStatusBarHandle function returns this handle.
-
nOption
nOption is an OR combination of the following values:
Name Value Description EXCEL_IGNORE_USED_RANGE 1 Matrix includes cell A1. Otherwise the used range is returned. EXCEL_DETAILED_FORMAT 2 Type matrix contain cell format Default value is 0.
Comment
All return matrices have the same number of rows and columns. A sheet can be selected by its name or index nSheet.
A text cell can contain up to 2048 characters. Longer strings will be truncated.
For the following Excel sheet
- |
A | B | C |
1 | |||
2 | 123 | 456 |
ExcelRead and ExcelRead2 will return a 2 x 3 matrix. ExcelRead3 will return a 1 x 2 matrix, because the first row and the first column is empty.
Example
<rmData, smMat, rmType> = ExcelRead3("test1.xls", 1, 0, EXCEL_DETAILED_FORMAT);
if (smMat[1] == "Error" && len(smMat) == 1) {
MessageBox("test1.xls - Read error");
}
History
Version | Description |
---|---|
5.10.0 | Returns Number format. |
See also
Overview Excel Files, ExcelRead, ExcelRead2, ExcelWrite, ExcelGetSheetNames, IsFileExcel, excel_open, FileToField
id-1011472