Syntax
reporting_addData(sheetName, data, [headerRowsNo])
Description
Adds a number of rows to the Excel worksheet which was set up before with the reporting_setupSheet routine.There can be more than one call of this routine per reporting script. The writing process takes place in memory only, for the operations to be permanent, a call to the reporting_writeWorkbook routine is mandatory.
Parameters
Parameter name | Type | Required | Description |
---|---|---|---|
sheetName | string | Yes | The worksheet name. The worksheet should have been already set up. |
data | string [] | Yes | This is an array of data which will be written to the worksheet. The number of elements must be divisible by the number of elements of the columnTypes array that was used during the sheet setup. If the number is not divisible, an exception will be thrown. |
headerRowsNo | number | No | The number of rows of the already defined header (available since 1.5.4/1.6.4) |
Return type
The returned value has no meaning.
Example
Example 1
//prior setup of the worksheet reporting_setupSheet("Data", {"Name", "Position", "Age", "Wage"}, {0, 0, 1, 1}); //construction of the data string[] data = {"John Doe", "Developer", "30", "1300.50", "Paul Smith", "Project Manager", "41", "2500.00"}; string[] badData = {"John Doe", "Developer", "30", "1300.50", "Paul Smith", "Project Manager", "41", "2500.00", "extra value"}; //actual call of the routine reporting_addData("Data", data); //call with mismatching data will throw an exception: reporting_addData("Data", badData);