Trouble getting desired excel data
Hi,
I need to retrieve a certian row from an excel file but am running into problems. First I tried the COM object but since I do not have excel install on my machine it gave the error of unknown classID. So I moved onto the DDT driver and it seems to have issue with how the columns are formated. I want to get the second row of the attached sheet. But if you run the following code,
var path = "C:\\Users\\" + Sys.UserName + "\\Downloads\\test.xls";
var Driver = DDT.ExcelDriver(path, "Sheet1");
while (! Driver.EOF() )
{
for(i = 0; i < DDT.CurrentDriver.ColumnCount; i++)
Log.Message(DDT.CurrentDriver.ColumnName(i) + ": " + aqConvert.VarToStr(DDT.CurrentDriver.Value(i)));
Driver.Next(); // Goes to the next record
}
The second row is not correctly printed. I've tried several wasy to print that second row but I'm stumped.
Thank you joseph_michaud!!! That solved it.
I added ';IMEX=1' which did the trick.
'Qry.ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + path + "; Extended Properties ='Excel 12.0 Xml;HDR=YES;IMEX=1' ";'