Forum Discussion

TonyM's avatar
TonyM
Occasional Contributor
11 years ago

Please Help!! Excel problem.

The 2 functions provided below will do the following: 1) Read from an Excel file. 2) Write to an Excel file. 3) But it does not read and write to the 'same' excel file.  It will only read...
  • murugans1011's avatar
    11 years ago
    //Code for reading from Excel:

    function readFromXL(fileName, sheetName, row, col){

    try{

     

    var Driver;

     

      // Creates the driver

      // If you connect to an Excel 2007 sheet, use the following method call:

       Driver = DDT.ExcelDriver(fileName, sheetName,true);

      //Driver = DDT.ExcelDriver(fileName, sheetName);

     

      Driver.First();

      var i;

      for (i=2; i<row; i++){

      Driver.Next();

      }

     

       tmpCol= aqConvert.VarToStr(DDT.CurrentDriver.Value(col));

       DDT.CloseDriver(Driver.Name);

       return tmpCol

       

      }catch(e){

      Log.Message(e.description);

    }

     }