Skip to content Skip to sidebar Skip to footer

Copy Contents Of Range Object (excel Column) To An Array Via Javascript

what I want to do is access an excel file, take the contents of a column and then store it in an array. I'm guessing this can be done by iterating through each element of the range

Solution 1:

Please check the following code to get data from an excel file. Hope this helps you:

CODE:

functionGetData(){ 
          var excel = newActiveXObject("Excel.Application"); 
          var excel_file = excel.Workbooks.Open("C:\\Data.xls"); 
          var excel_sheet = excel.Worksheets("Sheet2"); 
          for(var i=2;i<20;i++){
            var myrow = excel_sheet.Range("A"+i);    //to read values in row Adocument.getElementById('div1').innerHTML = myrow; 
          }
}

Tested in IE9.

Post a Comment for "Copy Contents Of Range Object (excel Column) To An Array Via Javascript"