Running a query on Excel sheet coming back with no values
I'm trying to pull a specific value from an Excel sheet by using a query but I get back nothing in my log. I've spent too much time already trying to get it to work. See the script below that I created. Any help will be much appreciated.
function ReadDataFromExcel()
{
var myDriver = DDT.ExcelDriver("C:\\IUL_Calc.xlsm", "Activity");
myDriver.ADOCommandObject.CommandText = 'SELECT [Amount] FROM [Activity$] where [Date] = "6/30/2000" AND [Description] = "FLAT FEE"';
Log.Message(myDriver);
DDT.CloseDriver(myDriver.Name);
}
Missy
Yes, basicly the problem is in your query.
myDriver.Value(0) should work so long as you actually have data to retrieve. So, it's possible that your query is not returning anything due to the WHERE clauses.My GUESS is that the "Date" field, you're doing a where clause assuming it's a string... I'm betting it's NOT a string and that it's actually a date/time value in your execl spreadsheet so the string comparison won't work. You should check the actual spreadsheet and format that column to string if you want to use that Where clause or, somehow, replace the date string you have with the appropriate date/time value.