Search code examples
excelqtphp-uft

HP UFT operation retrieve DataTable.Value failed. The column <module> does not exist


I am trying to get data from an imported Excel file. This file contains only one sheet with some values.

Somehow I can not select a specific value, no matter what i try I always get an error:

HP UFT ERROR

This is my Code so far:

Datatable.Importsheet "C:\Temp\test.xlsx",1,Global
row = Datatable.GetSheet(1).GetRowCount

MsgBox row

DataTable.SetCurrentRow(1)
ID_Number = Datatable.Value("Module", 1) 

MsgBox("Erstes Feld ist: " & ID_Number)

I am sure that the Field exists in the Excel and that it is written right.

Thank you in advance


Solution

  • Change Datatable.Importsheet "C:\Temp\test.xlsx",1,Global to Datatable.Importsheet "C:\Temp\test.xlsx",1,1 to actually import the excel sheet into Global sheet on data table. If you debug, you will notice that the existing data is being pasted in the Action sheet.