Read excel data/links in javascript test complete

Originally posted by Ilakkk on November 18, 2022

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.

Originally posted by rraghvani on November 18, 2022

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

I suggest you check your spreadsheet

Originally posted by Ilakkk on November 18, 2022

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

Originally posted by Ilakkk on November 21, 2022

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.

Originally posted by rraghvani on November 21, 2022

Use For Loop to iterate through the cells.