Forum Discussion

Adagio's avatar
Frequent Contributor
7 years ago

reading and writing to spreadsheet



I've to use a spreadsheet to read the data from. This data would be used to run the Tests. I'm trying to write Javascript code to do that. I'm having some of the difficulties in getting the rowcount in the spreadsheet and then keeping the pointer at the row that I'm reading and then moving to the next row. I've to read one row at a time and then run the test. In the next iteration, I'd be reading the second row and then running the test. any help/guidance would be appreciated!


Thank you


  • Hi Helen,


    No, these are not functions. These are some variables which hold the values from the spreadsheet.

    I figured out the issue here. It was still being treated as an object and I was trying to read it without using any property.

    Here's what I've used.



    var getUsageCode = aqObject.GetPropertyValue(readExcel(i, 1, "Sheet1"), "Text")


    Thanks for your help!


9 Replies

  • tristaanogre's avatar
    Esteemed Contributor

    What is the code you're using?  Are you accessing Excel directly using Sys.OleObject or are you using a DDT.ExcelDriver?  For what you're trying to do, as explained, you're reading each row in the spreadsheet and, for each row, you run the test.  That's a classic use of the DDT.ExcelDriver.  

    • Adagio's avatar
      Frequent Contributor

      Thanks Robert! I was using the DDT driver, but the issue that I have is:


      1. How do I read only 1 row at a time, feed the data in the Test and Run it and then keep the RowPosition stored in a variable?

      2. In the Next Iteration, I'd want to read the Second row and get the Data and Run the Test. Keep Repeating the steps until the last populated row of the spreadsheet. 



      Thank you


      • Marsha_R's avatar
        Champion Level 3

        The DDT driver helps you go through the rows automatically.   There's an example for you in that link that I posted.  


        "The code below illustrates the use of DDT.ExcelDriver. This code creates a DDT driver for an Excel sheet, runs through records of the driver’s table and posts values stored in record fields to the test log"