20 DataTable Utility Module

This chapter provides a complete listing and reference for the methods in the OpenScript DataTableService Class of Data Table Module Application Programming Interface (API).

20.1 DataTableService ENUM Reference

The following section provides an alphabetical listing of the enums in the OpenScript DataTableService API.

20.1.1 Alphabetical Enum Listing

The following table lists the DataTableService Enums in alphabetical order.

Table 20-1 List of DataTableService Enums

Enum Description

ExportMode

Sets the export mode for saving datatables to Excel files.


20.2 DataTableService API Reference

The following section provides an alphabetical listing of the methods in the OpenScript DataTableService API.

20.2.1 Alphabetical Command Listing

The following table lists the DataTableService API methods in alphabetical order.

Table 20-2 List of DataTableService Methods

Method Description

datatable.addColumn

Adds a column before the column whose index is columnAdded in the specific sheet.

datatable.addSheet

Adds a sheet in the current datatable before given sheet name without using first row as column header.

datatable.changeSheet

Changes the input sheet name to the new sheet name.

datatable.debugDump

Prints the content of current datatable into the Console.

datatable.deleteColumn

Deletes the column whose name is specified by columnName in the sheet whose name is specified by sheetName.

datatable.deleteRow

Deletes a new row before the current row.

datatable.deleteSheet

Deletes a sheet in the current datatable.

datatable.exportSheet

Exports a sheet in the current datatable into a new excel document.

datatable.exportSheets

Exports a sheet in the current excel document into excel document.

datatable.exportToExcel

Exports the current excel document into an excel document whose name is specified by path.

datatable.getColumn

Gets the column name in the specified sheet.

datatable.getColumnCount

Gets column count in the specified sheet.

datatable.getColumnIndex

Gets the column index by column name in the specified sheet.

datatable.getCurrentRow

Gets the current active row number which is 0 based in the current sheet.

datatable.getCurrentSheet

Gets the name of the current sheet.

datatable.getGlobalDatatable

Creates an instance of datatable in top-level script in the chain of parent scripts.

datatable.getParentDatatable

Creates an instance of datatable in parent script, if one exists and declared its own datatable service.

datatable.getRowCount

Gets the total count of the rows in the specific sheet.

datatable.getSheet

Gets the sheet name.

datatable.getSheetCount

Gets the total count of the sheets.

datatable.getValue

Gets the value of the specific cell in the specified sheet.

datatable.importAllSheets

Imports all sheets into the current data table.

datatable.importExcel

Imports a new excel document by path specifying if first row is used as header row.

datatable.importSheet

Imports a sheet into the current data table.

datatable.importSheets

Import sheet list into the current data table.

datatable.insertRow

Inserts a new row before the current row.

datatable.isFirstRowAsColumnHeader

Check to find if a sheet uses the first row as headers for columns.

datatable.setCurrentRow

Sets the specified row number to the active row in the specified sheet.

datatable.setCurrentSheet

Sets the current sheet as indicated by sheet name.

datatable.setNextRow

Sets the next row to the active row in the current sheet.

datatable.setPreviousRow

Sets the previous row to the active row in the current sheet.

datatable.setValue

Sets the value to the specific cell in the specified sheet.

datatable.updateColumn

Updates the name of the column whose name is specified by columnName in the sheet whose name is sheetName.

datatable.useFirstRowAsColumnHeader

Sets the first row of data as columns header.


The following sections provide detailed reference information for each method and enum in the DataTableService Class of Data Table Module Application Programming Interface.

datatable.addColumn

Adds a column before the column whose index is columnAdded in the specific sheet.

Format

The datatable.addColumn method has the following command format(s):

datatable.addColumn(columnName);

datatable.addColumn(columnName, columnAdded);

datatable.addColumn(sheetName, columnName);

datatable.addColumn(sheetName, columnName, columnAdded);

Command Parameters

columnName

a String specifying the new added column name.

columnAdded

is 0 based column index,the new column will be added beforethis column.

sheetName

a String specifying the sheet name.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Adds a new column after the last column in the specified sheet.

datatable.addColumn("Sheet1", "columnName", 1);

datatable.addSheet

Adds a sheet in the current datatable before given sheet name without using first row as column header.

First row of new sheet will not be used as column header.

Format

The datatable.addSheet method has the following command format(s):

datatable.addSheet(sheetName);

datatable.addSheet(sheetName, firstRowAsColHeader);

datatable.addSheet(sheetName, aheadSheetName);

datatable.addSheet(sheetName, aheadSheetName, firstRowAsColHeader);

Command Parameters

sheetName

a String specifying the name of the sheet to be added.

firstRowAsColHeader

a Boolean specifying whether to use the first row as the column name.

aheadSheetName

a String specifying the name of the sheet to add the new sheet before.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Adds a sheet in the current datatable.

datatable.addSheet("Sheet1", "Sheet2");

datatable.changeSheet

Changes the input sheet name to the new sheet name.

Format

The datatable.changeSheet method has the following command format(s):

datatable.changeSheet(oldSheetName, newSheetName);

Command Parameters

oldSheetName

a String specifying the sheet name that will be changed.

newSheetName

a String specifying new sheet name.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Changes the input sheet name to the new sheet name.

datatable.changeSheet("Sheet1", "mySheet1");

datatable.debugDump

Prints the content of current datatable into the Console.

Use this method during script debugging to dump the content of current datatable into Console. Do not use on normal playback, as it slows down execution and increases the size of the Console. After debugging just change value of dumDT to false.

Format

The datatable.debugDump method has the following command format(s):

datatable.debugDump(notes);

Command Parameters

notes

a String to identify the current datatable dump in the console.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Prints the content of current datatable into the Console.

run(){
boolean dumpDT = true;
...
 if(dumpDT)//later in run section
  datatable.debugDump("Test dump");     
...
}

datatable.deleteColumn

Deletes the column whose name is specified by columnName in the sheet whose name is specified by sheetName.

Format

The datatable.deleteColumn method has the following command format(s):

datatable.deleteColumn(columnName);

datatable.deleteColumn(sheetName, columnName);

Command Parameters

columnName

a String specifying the deleted column name.

sheetName

a String specifying the sheet name in which the column will be deleted.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Deletes the column specified by columnName in the specified sheet.

datatable.deleteColumn("Sheet1", "columnName");

datatable.deleteRow

Deletes a new row before the current row.

Format

The datatable.deleteRow method has the following command format(s):

datatable.deleteRow(sheetName, rowIndex);

Command Parameters

sheetName

a String specifying sheet name.

rowIndex

0 based row index.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Deletes a new row before the current row.

datatable.deleteRow("Sheet1", 2);

datatable.deleteSheet

Deletes a sheet in the current datatable.

Format

The datatable.deleteSheet method has the following command format(s):

datatable.deleteSheet(sheetName);

Command Parameters

sheetName

a String specifying the name of the sheet to be deleted.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Deletes a sheet in the current datatable.

datatable.deleteSheet("Sheet2");

ExportMode

The ExportMode has the following values:

Table 20-3 List of ExportMode Values

Value Description

CREATE

Create a new Excel file comprised of exported sheets only.

MERGE

Add exported sheets to existing sheets. If the existing spreadsheet has the same name as the exported sheet, then the existing sheet will be overwritten.


datatable.exportSheet

Exports a sheet in the current datatable into a new excel document.

Format

The datatable.exportSheet method has the following command format(s):

datatable.exportSheet(path, sourceSheetName, destSheetName);

datatable.exportSheet(path, sourceSheetName, destSheetName, exportMode);

Command Parameters

path

a String specifying the absolute path of the new excel document.

sourceSheetName

a String specifying the name of the sheet to be exported.

destSheetName

a String specifying the new name of the sheet to be exported.

exportMode

an ExportMode enum of ExportMode.CREATE or ExportMode.MERGE. CREATE means create new excel file comprised of exported sheet only. MERGE means add exported sheets to existing sheets. If the existing spreadsheet has the same name as the exported sheet, then the existing sheet will be overwritten.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Exports the current datatable into an excel document.

datatable.exportSheet("C:\\OracleATS\\Book1.xls", "Sheet1", "Sheet1", 
 ExportMode.CREATE);

datatable.exportSheets

Exports a sheet in the current excel document into excel document.

Format

The datatable.exportSheets method has the following command format(s):

datatable.exportSheets(destPath, sheetlist);

datatable.exportSheets(destPath, sheetlist, expMode);

Command Parameters

destPath

a String specifying the absolute path of the new excel document.

sheetlist

a List specifying the name of the sheet to be exported.

expMode

an ExportMode enum of ExportMode.CREATE or ExportMode.MERGE. CREATE means create a new excel file comprised of exported sheets only. MERGE means add exported sheets to existing sheets. If the existing spreadsheethas the same name as the exported sheet, then the existing sheet will be overwritten.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Exports sheets in the current datatable document into a new excel document.

import java.util.List;
import java.util.ArrayList;
//[...]
List<String> sheetList = new ArrayList<String>();
sheetList.add("Sheet1");
sheetList.add("Sheet2");
datatable.exportSheets("C:\\OracleATS\\Book1.xls", sheetList, 
 ExportMode.CREATE);

datatable.exportToExcel

Exports the current excel document into an excel document whose name is specified by path.

The method does the same job as {@code exportSheets()} for all sheets in the current datatable.

Format

The datatable.exportToExcel method has the following command format(s):

datatable.exportToExcel(path);

datatable.exportToExcel(path, expMode);

Command Parameters

path

a String specifying the absolute path of the new excel document.

expMode

an ExportMode enum of ExportMode.CREATE or ExportMode.MERGE. CREATE means create a new excel file comprised of exported sheets only. MERGE means add exported sheets to existing sheets. If the existing spreadsheet has the same name as the exported sheet, then the existing sheet will be overwritten.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Exports the current datatable into an excel document.

datatable.exportToExcel("C:\\OracleATS\\Book1.xls", ExportMode.CREATE);

datatable.getColumn

Gets the column name in the specified sheet.

Format

The datatable.getColumn method has the following command format(s):

datatable.getColumn(sheetIndex, columnIndex);

datatable.getColumn(sheetName, columnIndex);

Command Parameters

sheetIndex

specifies 0 based sheet index.

columnIndex

specifies 0 based column index.

sheetName

a String specifying sheet name.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Returns

the column name.

Example

Gets the column name of column index 0 within the sheet named Sheet1.

String getCol = datatable.getColumn("Sheet1", 0);
info("Sheet1, column index 0 = " + getCol);

datatable.getColumnCount

Gets column count in the specified sheet.

Format

The datatable.getColumnCount method has the following command format(s):

datatable.getColumnCount(sheetIndex);

datatable.getColumnCount(sheetName);

Command Parameters

sheetIndex

specifies 0 based sheet index.

sheetName

a String specifyingthe name of sheet.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Returns

the column count.

Example

Gets column count in the sheet with the name "Sheet1".

int getColCount = datatable.getColumnCount("Sheet1");
info("Sheet1 column count = " + getColCount);

datatable.getColumnIndex

Gets the column index by column name in the specified sheet.

Format

The datatable.getColumnIndex method has the following command format(s):

datatable.getColumnIndex(colName);

datatable.getColumnIndex(sheetName, colName);

Command Parameters

colName

a String specifying the name of column.

sheetName

a String specifying the name of sheet.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Returns

zero-based index of column or -1, if there is no such column

Example

Gets column index of the column with the name "Data4" in Sheet1.

int getColIndex = datatable.getColumnIndex("Sheet1", "Data4");
info("Sheet1, Data4 column index = " + getColIndex);

datatable.getCurrentRow

Gets the current active row number which is 0 based in the current sheet.

Format

The datatable.getCurrentRow method has the following command format(s):

datatable.getCurrentRow( );

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Returns

row index of current sheet.

Example

Gets the current active row number.

int curRow = datatable.getCurrentRow();
info("Current row is: " + curRow);

datatable.getCurrentSheet

Gets the name of the current sheet.

Format

The datatable.getCurrentSheet method has the following command format(s):

datatable.getCurrentSheet( );

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Returns

the name of current sheet.

Example

Gets the name of the current sheet.

String curSheet = datatable.getCurrentSheet();
info("Current sheet is: " + curSheet);

datatable.getGlobalDatatable

Creates an instance of datatable in top-level script in the chain of parent scripts.

Each script declares its own datatable service. Can be used to manipulate top-level datatable from the child script.

Format

The datatable.getGlobalDatatable method has the following command format(s):

datatable.getGlobalDatatable( );

Returns

instance of global datatable, if any,or this datatable if this script runs alone.

Example

Gets the global datatable.

DataTableService globalDatatable = datatable.getGlobalDatatable();
globalDatatable.setValue(0, "A", 15);
globalDatatable.save();

datatable.getParentDatatable

Creates an instance of datatable in parent script, if one exists and declared its own datatable service.

Can be used to manipulate parent datatable from the child script.

Format

The datatable.getParentDatatable method has the following command format(s):

datatable.getParentDatatable( );

Returns

instance of parent datatable, if any,or null, if this script runs alone or parent script doesn't declared datatable service.

Example

Gets the parent datatable.

DataTableService parDatatable = datatable.getParentDatatable();
if(parDatatable != null){
   parDatatable.setValue(0, "A", 15);
   parDatatable.save();
 }

datatable.getRowCount

Gets the total count of the rows in the specific sheet.

Format

The datatable.getRowCount method has the following command format(s):

datatable.getRowCount( );

datatable.getRowCount(sheetName);

Command Parameters

sheetName

a String specifying the name of the sheet.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Returns

the total count of the rows.

Example

Gets the total count of the rows in the specific sheet.

int rowCount = datatable.getRowCount("Sheet1");
info("Row count is: " + rowCount);

datatable.getSheet

Gets the sheet name.

Format

The datatable.getSheet method has the following command format(s):

datatable.getSheet(index);

Command Parameters

index

specifies the 0 based sheet index.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Returns

the name of the sheet.

Example

Gets the name of the sheet with index value 0.

String getSheet= datatable.getSheet(0);
info("Sheet1 name = " + getSheet);

datatable.getSheetCount

Gets the total count of the sheets.

Format

The datatable.getSheetCount method has the following command format(s):

datatable.getSheetCount( );

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Returns

the total count of sheets.

Example

Gets the name of the current sheet.

int sheetCount = datatable.getSheetCount();
info("Sheet count: " + sheetCount);

datatable.getValue

Gets the value of the specific cell in the specified sheet.

Format

The datatable.getValue method has the following command format(s):

datatable.getValue(row, column);

datatable.getValue(sheetName, row, column);

Command Parameters

row

specifies the 0 based row index.

column

a String specifying the column name.

sheetName

a String specifying the sheet name.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Returns

Object as a cell value.

Example

Gets the value of row 1, column A in the current sheet.

Object cellValue1 = datatable.getValue("Sheet1", 0, "A");
info("cell value = " + cellValue1.toString());

datatable.importAllSheets

Imports all sheets into the current data table.

If a sheet with the same name as the imported sheet exists in the data table, then behavior depends on overwrite parameter. If overwrite is true, then existing sheet will be overwritten. If overwrite is false, then the existing sheet will be preserved, but the imported sheet name will be appended with a numerical value from 1 to 50000.

Format

The datatable.importAllSheets method has the following command format(s):

datatable.importAllSheets(path, overwrite, firstRowAsColHeader);

Command Parameters

path

a String specifying the absolute path of the excel document that contains the imported sheets.

overwrite

a Boolean indicating whether to overwrite if same sheet name exists.

firstRowAsColHeader

a Boolean specifying how to treat the first row of imported sheets.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Imports all sheets into the current data table.

datatable.importAllSheets("C:\\OracleATS\\Book1.xls", true, false);

datatable.importExcel

Imports a new excel document by path specifying if first row is used as header row.

Differs from {@code improtAllSheets} in that existing sheets won't be preserved.

Format

The datatable.importExcel method has the following command format(s):

datatable.importExcel(path);

datatable.importExcel(path, firstRowAsColHeader);

Command Parameters

path

a String specifying the absolute file path of the new document.

firstRowAsColHeader

a Boolean specifying how to treat first row of imported sheets.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Imports a new excel document by path specifying if first row is used as header row.

datatable.importExcel("C:\\OracleATS\\Book1.xls", true);

datatable.importSheet

Imports a sheet into the current data table.

Existing sheets will be preserved. If the name of the existing sheet matches the name of the imported destination sheet, then name of destination sheet will be appended by a numbered suffix.

Example:

Destination sheet name is Sheet1, but data table already has sheet named Sheet1. After importing existing sheet, Sheet1 will be preserved, and imported sheet will get name Sheet11, unless Sheet11 already exists in data table. After import, the first row of the imported sheet will not be considered as a column header.

Format

The datatable.importSheet method has the following command format(s):

datatable.importSheet(path, sourceSheet, destSheet);

datatable.importSheet(path, sourceSheet, destSheet, firstRowAsColHeader);

Command Parameters

path

a String that specifies the absolute path of the Excel document that contains the imported sheet.

sourceSheet

a String specifying the imported sheet name in excel document.

destSheet

a String specifying the new sheet name in the current data table.

firstRowAsColHeader

a boolean specifying how to use first row of the imported sheet.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Import a sheet into the current data table specifying if first row is used as header row.

datatable.importSheet("C:\\OracleATS\\Book1.xls", "Sheet1", "Sheet1", true);

datatable.importSheets

Import sheet list into the current data table.

If a sheet with the same name as imported sheet exists in the data table, then behavior depends on the overwrite parameter. If overwrite is true, then existing sheet will be overwritten. If overwrite is false, then existing sheet will be preserved, but the imported sheet name will be appended with a numerical value from 1 to 50000.

Format

The datatable.importSheets method has the following command format(s):

datatable.importSheets(sourcePath, sheetList, overwirte);

datatable.importSheets(sourcePath, sheetList, bOverwirte, bUsingFirstRow);

Command Parameters

sourcePath

a String specifying the absolute path of the excel file that contains the imported sheets.

sheetList

a List specifying the sheet(s) that will be imported.

overwirte

a Boolean specifying whether to overwrite if the same sheet name exists.

bOverwirte

a Boolean specifying whether to overwrite if the same sheet name exists.

bUsingFirstRow

a Boolean specifying whether to use the first row as the column name.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Import sheet list into the current data table.

import java.util.List;
import java.util.ArrayList;
//[...]
List<String> sheetList = new ArrayList<String>();
sheetList.add("Sheet1");
sheetList.add("Sheet2");
datatable.importSheets("C:\\OracleATS\\Book1.xls", sheetList, true, false);

datatable.insertRow

Inserts a new row before the current row.

Format

The datatable.insertRow method has the following command format(s):

datatable.insertRow(rowIndex);

datatable.insertRow(sheetName, rowIndex);

Command Parameters

sheetName

a String specifying sheet name.

rowIndex

0 based row index.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Inserts a new row before row index 0 in Sheet1.

datatable.insertRow("Sheet1", 0);

datatable.isFirstRowAsColumnHeader

Check to find if a sheet uses the first row as headers for columns.

Format

The datatable.isFirstRowAsColumnHeader method has the following command format(s):

datatable.isFirstRowAsColumnHeader(sheetName);

Command Parameters

sheetName

a String specifying the name of a sheet in the data table.

Throws

AbstractScriptException

if Sheet with sheetName does not exist.

Returns

true, if the sheet set to use the first row as headers for columns, otherwise false.

Example

Checks if the first row of data is used as headers for columns.

Boolean isFirstHeader = datatable.isFirstRowAsColumnHeader("Sheet1");
info("First Row is Header = " + isFirstHeader);

datatable.setCurrentRow

Sets the specified row number to the active row in the specified sheet.

Format

The datatable.setCurrentRow method has the following command format(s):

datatable.setCurrentRow(row);

datatable.setCurrentRow(sheetName, row);

Command Parameters

row

0 based row index.

sheetName

a String specifying the name of the sheet.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Sets the a row to active in the current sheet.

datatable.setCurrentRow("Sheet1", 1);

datatable.setCurrentSheet

Sets the current sheet as indicated by sheet name.

Many data table methods are used against the current sheet in the table.

Format

The datatable.setCurrentSheet method has the following command format(s):

datatable.setCurrentSheet(sheetName);

Command Parameters

sheetName

a String specifying the name of sheet to set as the current sheet.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Sets the current sheet as indicated by sheet name.

datatable.setCurrentSheet("Sheet1");

datatable.setNextRow

Sets the next row to the active row in the current sheet.

If the current active row is at the end, set it to the beginning row.

Format

The datatable.setNextRow method has the following command format(s):

datatable.setNextRow( );

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Sets the next row to the active in the current sheet.

datatable.setNextRow();

datatable.setPreviousRow

Sets the previous row to the active row in the current sheet.

If the current active row is at the beginning, set it to the end row.

Format

The datatable.setPreviousRow method has the following command format(s):

datatable.setPreviousRow( );

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Sets the previous row to the active row in the current sheet.

datatable.setPreviousRow();

datatable.setValue

Sets the value to the specific cell in the specified sheet.

If the value begins with an equals sign (=), it will be considered a formula. For example "=sum(a1,a2)".

Format

The datatable.setValue method has the following command format(s):

datatable.setValue(row, column, value);

datatable.setValue(row, column, value);

datatable.setValue(row, column, value);

datatable.setValue(sheetName, row, column, value);

datatable.setValue(sheetName, row, column, value);

datatable.setValue(sheetName, row, column, value);

Command Parameters

row

specifies the 0 based row index.

column

a String specifying the column name.

value

the value to set. There are setValue methods for String value, Boolean value, and Double value.

sheetName

a String specifying the sheet name.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

Sets the value of row 1, column A in Sheet1 to "=sum(a1,a2)".

datatable.setValue("Sheet1", 0, "A", "=sum(a1,a2)");

datatable.updateColumn

Updates the name of the column whose name is specified by columnName in the sheet whose name is sheetName.

Format

The datatable.updateColumn method has the following command format(s):

datatable.updateColumn(col, value);

datatable.updateColumn(columnName, value);

datatable.updateColumn(sheetName, col, value);

datatable.updateColumn(sheetIndex, col, value);

datatable.updateColumn(sheetName, columnName, value);

Command Parameters

col

0 based column index.

value

a String specifying the new column name.

columnName

a String specifying the column name to be updated..

sheetName

a String specifying sheet name.

sheetIndex

0 based sheet index.

Throws

AbstractScriptException

represents an exception that may be thrown during the execution of a script where the exception should be reported to an end user through the controller.

Example

>Updates the name of the column "A" in Sheet1.

datatable.updateColumn("Sheet1", "A", "Data1");

datatable.useFirstRowAsColumnHeader

Sets the first row of data as columns header.

This setting can completely change the sheet behavior, if it was not previously set by one of import methods or by the import action in the datatable view.

When the first row is set as column headers, the first row of data in the in datatable sheet is used as a header for columns. The number of rows in the sheet is decremented, as all rows starting from the second row will be moved up. If the first row has any cell values that are not assigned yet, then a default Excel column name will be used for the column [A,B,..,Z,AA,AB,...,ZZ]. For example, before the first column policy is set to use first row as headers, the sheet with 2 rows:

col1, col2, col3

a21, a22, a23

was shown in Excel as:

headers: A, B, C

row1: col1, col2, col3

row2: a21, a22, a33

it will be shown the same way in the datatable sheet.

After the first column policy is set to use first row as headers, you will see datatable data in Excel the same as before, but in the datatatable view it shows as:

headers: col1, col2, col3

row1: a21, a22, a23

Format

The datatable.useFirstRowAsColumnHeader method has the following command format(s):

datatable.useFirstRowAsColumnHeader(sheetName);

Command Parameters

sheetName

is a name for sheet to set the desired behavior

Throws

AbstractScriptException

if the sheet with sheetName doesn't exist.

Example

Checks if the first row of data is used as headers for columns.

datatable.useFirstRowAsColumnHeader("Sheet1");