Forum Discussion
Hi Jainsoumya!
No action is taking place, because there is no action to perform in the code sample.
In the small sample above, TestComplete is simply opening and closing the sheet in the background.
Since there is no other action, such a Log event to post results, nothing is being returned.
Is there another action further down in your code that is not working? If you are only running the snippet provided, then no results in your logs is going to be the expected result.
- Jainsoumya3 years agoContributor
npaisley so what is the code to open the required excel file ?
- Marsha_R3 years agoModerator
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.
- Jainsoumya3 years agoContributor
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);
}}
Related Content
Recent Discussions
- 2 hours ago
- 6 days ago
- 10 days ago