ImportSheet Method

Description

Imports a sheet of a specified file to a specified sheet in the design-time or run-time data table. The data in the imported sheet replaces the data in the destination sheet (see SheetDest argument).

Notes:

The column headings in the sheet you import must match the data table parameter names in the action for which the sheet is being imported. Otherwise, your test or component may fail.

The sheet you import automatically takes the name of the sheet it replaces.

If you import an excel sheet containing combo box or list cells, conditional formatting, or other special cell formats, the formats are not imported and the cell is displayed in the data table with a fixed value.

For details on importing data sheets to components and Business Process Tests, see the topic on importing and exporting data sheets in the UFT One Help Center.

Syntax

DataTable.ImportSheet FileName, vtSrcSheet, vtDstSheet

Argument

Type

Description

FileName
String
The full or relative path of the Excel table from which you want to import a sheet. It can be a file system or ALM path.
SheetSource
Variant
The name or index of the sheet in the file that you want to import. Index values begin with 1.
SheetDest
Variant
The name or index of the sheet in the data table that you want to replace with the SheetSource. Index values begin with 1.

Example

The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's design-time or run-time data table.

DataTable.ImportSheet "C:\name.xls" ,1 ,"name"