Forum Discussion

tmahender12's avatar
tmahender12
Frequent Contributor
10 years ago

To get unique values from xls Colomn

HI,

 

I have a requirement, where there are 100 rows in a xls, with duplicate values in the cell, i need to get unique values from that colomn.

any ideas

11 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    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";
    
    

     

     

    • tmahender12's avatar
      tmahender12
      Frequent Contributor

      its not working

      getting error at

      MyExcelRecords = DDT.ExcelDriver("C:\MyDir\MyExcel.xls");