i want to transfer some user input data from a html page to my google sheet with google´s app scripts. I can do that for single values but could not figure out a nice way to
You can use Sheets API to parse and paste HTML directly.
let table = document.getElementById('tbl_posts').outerHTML;
google.script.run.pasteHtml(table);
function pasteHtml(table) {
var ss = SpreadsheetApp.getActive();
var req = {
requests: [
{
pasteData: {
html: true,
data: table,
coordinate: {
sheetId: ss.getSheets()[1].getSheetId(), //second sheet!A1
rowIndex: 0,
columnIndex: 0,
},
},
},
],
};
Sheets.Spreadsheets.batchUpdate(req, ss.getId());
}