Monday, February 28, 2011

Datatable - Import/Export

There are 4 methods that QTP provided to Import/Export a datatable to/from an .xls file.

1) Import method : This method is used to import an entire workbook into QTP datatable.
datatable.Import "D:\QTPScripts\Test_Folder\Testing.xls"'Imports the entire workbook

2) ImportSheet method : This method is used to import only a specific sheet into QTP datatable.
datatable.ImportSheet "D:\QTPScripts\Test_Folder\Testing.xls",1,2'Imports the source sheet (1) to destination sheet (2)

3) ExportSheet method : This method is used to export only a specific datatable sheet from QTP to an .xls file.
datatable.ExportSheet "D:\QTPScripts\Test_Folder\Testing.xls",1'Exports the specified sheet to a file; Overwrites by default, only one copy is exported.

4) Export method : This method is used to export the entire datatables from QTP to an .xls file.
datatable.Export "D:\QTPScripts\Test_Folder\Testing.xls"'Entire workbook is exported

Check out our QTP and VBScript section.

1 comment:

  1. hi

    I am trying to ExportSheet to .xls at Quality Center and it doesnt work. I am able to import. Any help is welcome.
    Christian
    christianesl@gmail.com

    ReplyDelete

Please leave your comment here...