12 years ago
DDT.ExcelDriver "Unexpected error"
I'm having some difficulty with the DDT.ExcelDriver, and I'm wondering if anyone has run across this before. Essentially my task is to read in some data from app generated Excel files (XLS and XLSX), I can then use that data for some further testing. The problem is that on certain XLS files the DDT.ExcelDriver throws an odd error: "Unexpected error from external database driver (22)".
Here is the (JScript) code that does it, all it's doing is reading data from the left-most column of the Excel sheet:
function GetLookupExcelData(varFilePath, varSheetName)
{
var outarray = [];
DDT.ExcelDriver(varFilePath, varSheetName, true);
while (!DDT.CurrentDriver.EOF())
{
var value = DDT.CurrentDriver.Value(0)
if (value) outarray.push(value);
DDT.CurrentDriver.Next();
}
DDT.CloseDriver(DDT.CurrentDriver.Name);
return outarray;
}
The error happens on the DDT.ExcelDriver(varFilePaqth, varSheetName, true) line. Note: this ONLY happens with XLS files (so far, but not every XLS file), if I have the same data in a XLSX file I don't get an error at all. Also note on the DDT.ExcelDriver calls, I've tried without the "true" parameter when using XLS files, and I still get the same result (i.e., with and without ACE driver support). I'm using TestComplete 9.10.1894.7.
I will try to attach two files (XLS and XLSX), both containing the same data, that demonstrates the issue.
Here is the (JScript) code that does it, all it's doing is reading data from the left-most column of the Excel sheet:
function GetLookupExcelData(varFilePath, varSheetName)
{
var outarray = [];
DDT.ExcelDriver(varFilePath, varSheetName, true);
while (!DDT.CurrentDriver.EOF())
{
var value = DDT.CurrentDriver.Value(0)
if (value) outarray.push(value);
DDT.CurrentDriver.Next();
}
DDT.CloseDriver(DDT.CurrentDriver.Name);
return outarray;
}
The error happens on the DDT.ExcelDriver(varFilePaqth, varSheetName, true) line. Note: this ONLY happens with XLS files (so far, but not every XLS file), if I have the same data in a XLSX file I don't get an error at all. Also note on the DDT.ExcelDriver calls, I've tried without the "true" parameter when using XLS files, and I still get the same result (i.e., with and without ACE driver support). I'm using TestComplete 9.10.1894.7.
I will try to attach two files (XLS and XLSX), both containing the same data, that demonstrates the issue.