Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
accessexcelfile [2020/04/26 03:33]
127.0.0.1 external edit
— (current)
Line 1: Line 1:
-===== Read Excel File ===== 
- 
-Excel file (*.xls files Excel 2003) can be read by MScript.  It involves declaring a data set that points to the Excel file and use $getData() function to read the data from the data set. 
- 
-Below is a simple example that demonstrate this: 
- 
- 
-  <!-- declare data set --> 
-  <dataset id="fileDS" autorewind="true" mode="replace" db="Excel:dataSetFile.xls"/> 
-   
-  <!-- load data from the file --> 
-  <action code="$loadFromDataSource('fileDS')"/> 
-   
-  <!-- read the data from data set --> 
-  <log level="" message="$dataSetInfo('fileDS')"/> 
-  <log msg="reading data: $getData('fileDS','col1')"/> 
-   
-  <!-- advance data set to next row --> 
-  <action code="$nextDataSetRow('fileDS')"/> 
-  <log msg="reading next row: $getData('fileDS','col1')"/> 
- 
- 
-By detault, the first sheet is read.  To read a specific sheet, append the name of the sheet to //db// attribute as follows: 
- 
-  <dataset id="fileDS" autorewind="true" mode="replace" db="Excel:dataSetFile.xls;mySheetName"/> 
-