Forum Discussion
Consider using the DDT.ExcelDriver object. This allows you to connect to your Excel sheet and then interate through the records to find what you're looking for. You can also pass in an SQL query to this object to reduce the recordset down to only what you want by calling the ADOCommandObject.CommandText. Something like this
var MyExcelRecords;
MyExcelRecords = DDT.ExcelDriver("C:\MyDir\MyExcel.xls");
MyExcelRecords.ADOCommandObject.CommandText = "SELECT DISTINCT Col_1 from MyExcel.xls";
- tmahender1210 years agoFrequent Contributor
its not working
getting error at
MyExcelRecords = DDT.ExcelDriver("C:\MyDir\MyExcel.xls");- altemann10 years agoContributorWhat error are you getting?
- tristaanogre10 years agoEsteemed Contributor
My sample code I gave was intended to be pseudo-code and not necessarily something to be implemented as is.
Looking over what I wrote, if you're going to use the JScript language (which is what I was using) it should look like this:function GetCol1Unique(); { var MyExcelRecords; MyExcelRecords = DDT.ExcelDriver("C:\\MyDir\\MyExcel.xls"); MyExcelRecords.ADOCommandObject.CommandText = "SELECT DISTINCT Col_1 from MyExcel.xls"; return MyExcelRecords; }Note that the pathing needs to use double backslashes as the backslash is a special character for use in strings in JScript.
But, as mentioned, it would be helpful to know what the error is that you're getting.