.. highlightlang:: us .. index:: ExcelReadEx .. _excelreadex: ExcelReadEx =========== .. us.tag ExcelReadEx ENGLISH New5509 The :ref:`ExcelReadEx` function reads MS-Excel with the extension .xlsx, .xls and .xlsb. .. function:: smMatrix = ExcelReadEx(ssFileName) smMatrix = ExcelReadEx(ssFileName, ssSheetName) smMatrix = ExcelReadEx(ssFileName, nSheet) = ExcelReadEx(ssFileName) = ExcelReadEx(ssFileName, ssSheetName) = ExcelReadEx(ssFileName, nSheet) = ExcelReadEx(ssFileName) = ExcelReadEx(ssFileName, ssSheetName) = ExcelReadEx(ssFileName, nSheet) = ExcelReadEx(ssFileName, nSheet, hStatusWnd) = ExcelReadEx(ssFileName, ssSheetName, hStatusWnd) .. us.return **Return Value** *smMatrix* contains the data of an Excel spreadsheet as a string matrix. If an error occurs, *smMatrix* is a scalar, empty string (``""``). *rmData* is a real matrix. If the type matrix (*smType*) element has the value ``"S"`` or ``"B"``, the corresponding element in *rmData* has the value 0.0. *smString* is a string matrix. If the type matrix (*smType*) element has the value ``"S"`` or ``"B"``, the corresponding element in *smString* has the value ``""`` (empty string). *smType* is a string matrix. The elements contain the data types of the corresponding spread sheet cells: .. list-table:: :header-rows: 1 * - Value - Meaning * - ``""`` - Number field. * - ``"S"`` - String field. * - ``"B"`` - Blank (empty) field. .. us.params **Parameters** .. uparam:: ssFileName *ssFileName* is the name of the Excel file, i.e. ``"c:\\excel\\test.xls"`` or :file:`c:/excel/test.xls`. .. uparam:: ssSheetName *ssSheetName* is the sheet name of the Excel 5.0 file. If this parameter is not specified, the first sheet will be read. .. uparam:: nSheet *nSheet* is the sheet index of the Excel 5.0 file. If this parameter is not specified, the first sheet will be read. .. uparam:: hStatusWnd Is the handle of the status bar window. It is used to display processing progress (default is 0). The :ref:`AppGetStatusBarHandle` function returns this handle. .. us.comment **Comment** All output parameters have the same number of rows and columns. A sheet of an Excel 5.0 file can be accessed by the sheet name of the sheet index. In case of an error, the output parameter has only one element with the value 0.0 or "" (empty string), i.e. ``rmData[1;1] = 0.0``, ``smString[1;1] = ""`` and ``smType[1;1] = ""``. The number of characters per cell is limited to 2048 characters. Longer strings will be truncated. .. us.example **Example** :: = ExcelReadEx("c:\\test\\test1.xlsx") if (smType[1] == "" && len(smType) == 1) { MessageBox("test1.xls - read error"); } .. seealso:: :ref:`overview-excel-files`, :ref:`ExcelRead`, :ref:`ExcelWrite`, :ref:`ExcelWriteEx`, :ref:`ExcelGetSheetNames`, :ref:`IsFileExcel` :sub:`id-1892075`