I'm looking for a way to update a header of an element of a google form with specific data from a cell of google spreadsheet. As the data in the spreadsheet is changing, so should the header of the form element.
Here is my code I'm using.
function readTheSheet() {
var ss = SpreadsheetApp.openById("SpreadsheetKey");
var active = SpreadsheetApp.setActiveSpreadsheet(ss);
var sheet = SpreadsheetApp.setActiveSheet(ss.getSheets()[4]);
var data = ss.getDataRange().getValues(); // Data for pre-fill
var formUrl = ss.getFormUrl();
var form = FormApp.openByUrl(formUrl);
var items = form.getItems();
var formItem = items[0].asTextItem();
formItem.setTitle('Aktueller Clankrieg: ' + data[1][0]);
Logger.log(data[1][0]);
};
This code is running fine, exept that it's not updating when someone is responding to the form. As per Google Dev the onOpen() trigger runs only when a user opens a form, not when responding to one.
Does anyone know if and how this could be done?
If yes, any help or direction will be GREATLY appreciated.
Thank you in advance! Smite