Forum Discussion
You have the correct code to open the file but what npaisley is saying is the open does not count as an action for TestComplete so it does not log it. The file has been opened in the background and nothing is visible. Same for the sheet reference. You set it to a variable but this is not a logged action.
Try doing something next like getting a value from the sheet and putting it in a log message. That will show an action.
Marsha_R I tried doing like getting a value of row or column but then also excel file didnt get open
function ReadDataFromExcel()
{
let Excel = getActiveXObject("Excel.Application");
Excel.Workbooks.Open("C:\\Users\\Public\\TestInput\\ChartInput.xlsx");
let RowCount = Excel.ActiveSheet.UsedRange.Rows.Count;
let ColumnCount = Excel.ActiveSheet.UsedRange.Columns.Count;
for (let i = 1; i <= RowCount; i++)
{
let s = "";
for (let j = 1; j <= ColumnCount; j++)
s += (VarToString(Excel.Cells.Item(i, j)) + "\r\n");
Log.Message("Row: " + i, s);
}
}