I have 4 form that I need to post to different sheets. I have the following code that with let the forms post but only to the current(Active) sheet but I cannot get it to post to a different sheet.
Another option is if I can have one form and depending what department(Sheet Name) you select it would post to that sheet.
function openDialog1() {
var html = HtmlService.createHtmlOutputFromFile('form1.html');
SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
.showModalDialog(html, 'Pop up Form');
}
function openDialog2() {
var html = HtmlService.createHtmlOutputFromFile('form2.html');
SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
.showModalDialog(html, 'Pop up Form');
}
function openDialog3() {
var html = HtmlService.createHtmlOutputFromFile('form3.html');
SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
.showModalDialog(html, 'Pop up Form');
}
function openDialog4() {
var html = HtmlService.createHtmlOutputFromFile('form4.html');
SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
.showModalDialog(html, 'Pop up Form');
}
function doGet(e){
return HtmlService.createHtmlOutputFromFile('index').setTitle('Adding Rows');
}
function doPost(e) {
Logger.log(e);
}
function sendText(data){
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow([data.item_number, data.shop_number, data.escalation, data.Hide1, data.notes, data.problem, data.added_by, data.incoive_date, data.location_order, data.user_working, data.CS_rep, data.shipping, data.department]);
return 'success!';
}
Here is a link to my test Spreadsheet so you can see the HTML and test.
https://docs.google.com/spreadsheets/d/1iWQ40boplJcJmdFg9HNIyOAOrHOjlCRu362LWRdV5y0/edit?usp=sharing