I have an HTML web form with 5 text inputs and a button that calls a JavaScript function. The function in its current form will open an existing Excel file, find the last completed row, add a new row under it and place the form values in one value for each cell. Then it saves and exits.
However, a table has much more than 5 columns, so the function only ever puts data in AE columns.
function createData(){
var first = document.getElementById('A').value;
var second = document.getElementById('B').value;
var third = document.getElementById('C').value;
var fourth = document.getElementById('D').value;
var fifth = document.getElementById('E').value;
var xlDown = -4121
var w =new ActiveXObject("Excel.Application");
w.Visible=true;
w.Workbooks.Open("file:\\Form.xls");
objWorksheet = w.Worksheets(1);
objRange = w.Range("A1");
objRange.End(xlDown).Activate;
intNewRow = w.ActiveCell.Row + 1;
for (i=1; i<10000; i++){
objWorksheet.Cells(intNewRow, 1) = first;
objWorksheet.Cells(intNewRow, 2) = second;
objWorksheet.Cells(intNewRow, 3) = third;
objWorksheet.Cells(intNewRow, 4) = fourth;
objWorksheet.Cells(intNewRow, 5) = fifth;
}
w.ActiveWorkbook.SaveAs("file:\\Form.xls");
w.Quit();
alert("The data has been added to the spreadsheet");
}
What I really want to do is the following:
A-G .
, B "first" ( ). , 4 H-K. , 5 "" B, H-K.
, , .
!