jquery - Creating xls in javascript using ActiveXObject -
my code
var fsobj = new activexobject("scripting.filesystemobject"); var excelapp = new activexobject("excel.application"); excelapp.displayalerts = false; var wbobj = excelapp.workbooks.add; var wsobj = wbobj.worksheets(1);
when use below code works fine (i.e., executes excel , fills in 2 rows)
wsobj.cells(1,1).value="hello"; wsobj.cells(2,1).value=comparedata.response.length; wbobj.application.visible=true;
but when use below code says expected ';'
in 3rd line (with hello), not able find problem here. here jsfiddle link, not working though, if can make work
for(i=0;i<comparedata.response.length;i++) { wsobj.cells(i,1).value="hello"; } wbobj.application.visible=true;
row numbers in excel start 1, not 0. should write
for(i=0; i<comparedata.response.length; i++) { wsobj.cells(i + 1, 1).value="hello"; }
Comments
Post a Comment