I'm running Excel tests on UFT and sometimes I get the error number 20012 which is "DataTable.ImportSheet operation failed.Invalid file".
This is my way of importing the script:
filepath is the path of my workbook which conatins many excel sheets (scripts)</li> <li>
scriptname: the name of the script that I want to run</li> <li>
Action2: contains all the call of all possible keywords that may script can contains.</li> </ul>
Any help please, why I'm getting this error.
The problem is that this is working well for some scripts and for others not after 3 or 4 run times.
I think the problem is on Excel itself and not on the code, are there any problems when working with Excel 2016 and UFT 12 ?Answer1:
UFT syntax for importing a worksheet is:
DataTable.ImportSheet FileName, vtSrcSheet, vtDstSheet
This means you need to pass as parameters the filename (and path) to the excel file, the name (or index) of the source sheet you want to import, and then the destination you want this sheet to be (for example "Global" or "Action1" etc)
scriptname happens to be the exact name of the worksheet you are trying to import you will get this error.
If you want to import the whole file use
Datatable.Import instead of