Forum Discussion

Ilakkk's avatar
Ilakkk
Contributor
2 years ago
Solved

Read excel data/links in javascript test complete

Hi team, I have tried to read the data file using javascript in test complete.But shows error as "Type error: cannot read the property 'SheetByTitle' of null"

function ExcelRead()
{
    var excelFile = Excel.Open("C:\\temp\\DataStorageExcel.xlsx");
  var excelSheet = excelFile.SheetByTitle("Sheet1");

  var valueA = excelSheet.Cell("A", 3).Value;
  var valueB = excelSheet.Cell(2, 3).Value;
  var valueC = excelSheet.CellByName("C3").Value;
}

 

 

 

Can any one help regarding this issue or I want to fetch the weblinks from excel file one by one that links need to execute.

Thanks in advance.

  • There's no problem with the code, as it works (using TC v15.45.31.7)

    I suggest you check your spreadsheet

     

4 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    There's no problem with the code, as it works (using TC v15.45.31.7)

    I suggest you check your spreadsheet

     

    • Ilakkk's avatar
      Ilakkk
      Contributor

      Hey, Thanks a lot. I did small mistake while giving the path.

    • Ilakkk's avatar
      Ilakkk
      Contributor

      Hey one more help for me. For the same code how can I get the row/cell values one by one.

      For example, in row I have stored some links first I want to hit the first link the script completed I want to hit next link and so on.