I am looking to manipulate an existing Excel file by writing values from an array and closing it all on the client side. Here is the code snippet I have been using:
for (var c=0; c<arrMCN.length; c++)
{
var mcnCreate = arrMCN[c];
var mcnNumber =mcnCreate.getProperty("agu2a_nb");
var mcnType=mcnCreate.getProperty("pdm_ecn_type");
var mcnProjectCode=mcnCreate.getProperty("pdm_project_code");
var mcnState=mcnCreate.getProperty("state");
var Excel = new ActiveXObject("Excel.Application");
Excel.Visible = true;
Excel.Workbooks.Open("C:\\test.xls");
Excel.Activesheet.Cells(1,1).Value = mcnNumber;
var data = Excel.Activesheet.Cells(1,1).Value;
return data;
}
Encountering the "ActiveX component cannot create an object" error was a setback for me initially. However, after tweaking the security settings in the Internet options, the error was resolved.
After successfully writing just one value into the Excel file, my next goal is to figure out how to efficiently write all the data from the array into the spreadsheet.
Any insights or suggestions on this matter would be greatly appreciated!