trying to get the cell values from html table and send them to google sheet via apps script:
index.html:
var values = [];
$("td").each(function(){
values.push($(this).text());
});
alert(values); // i can see the array in the alert.
google.script.run.addRows(values);
}
code.gs:
function addRows(values) {
var doc = SpreadsheetApp.openById("id");
var sheet = doc.getSheetByName('newdata');
var lastrow = sheet.getLastRow();
sheet.getRange(lastrow+1, 1, values.length, values[0].length).setValues(values);
}
i got an error in the console uncaught addRows, it seems that the array is not detected on the server side, can anyone help thanks in advance