Forum Discussion

cyclopsthere's avatar
cyclopsthere
New Member
11 years ago

Getting and adding values from Excel, Test Complete Samples Missing

Hello,

The documentation claims the samples for using Excel are located in the Users\public\documents... folder but I'm unable to find them. Perhaps they've moved?   

 

I'm using JScript to try and add a list of numbers in a specific row in Excel.  Below is the code in the help file for using COM.  The problem I've found is finding what method to use to convert all items to an integer, if they aren't a number then disregard, then add all numbers and push them to a variable. 

 

 

 

function ReadDataFromExcel()
{
  var Excel = Sys.OleObject("Excel.Application");
  Excel.Workbooks.Open("C:\\MyFile.xls");

  var RowCount = Excel.ActiveSheet.UsedRange.Rows.Count;
  var ColumnCount = Excel.ActiveSheet.UsedRange.Columns.Count;

  for (var i = 1; i <= RowCount; i++)
  {
    var s = "";
    for (var j = 1; j <= ColumnCount; j++)
      s = s + VarToString(Excel.Cells(i, j)) + Chr(13) + Chr(10)
    Log.Message("Row: " + VarToString(i), s);
  }

  Excel.Quit();

}

 

 

No RepliesBe the first to reply