I wanted to create a form for data collection that included a field for image upload. I tried Google Forms, which natively doesn't support file upload, but I found this example: Form and file upload with htmlService and app script not working
I managed to configure it with image upload, BUT, native Google Forms does have a timestamp column on the Spreadsheet responses.
I tried:
var timestamp = theForm.getTimestamp();
But didn't work...
How can I get the response timestamp?
Code excerpt:
function processForm(theForm) {
var fileBlob = theForm.myFile;
var folder = DriveApp.getFolderById(folderId);
var doc = folder.createFile(fileBlob);
// Fill in response template
var template = HtmlService.createTemplateFromFile('Thanks.html');
var name = template.name = theForm.name;
var email = template.email = theForm.email;
var timestamp = template.timestamp = theForm.getTimestamp();
// Record submission in spreadsheet
var sheet = SpreadsheetApp.openById(submissionSSKey).getSheets()[0];
var lastRow = sheet.getLastRow();
var targetRange = sheet.getRange(lastRow+1, 1, 1, 5).setValues([[timestamp,name,department,message,email,fileUrl]]);
// Return HTML text for display in page.
return template.evaluate().getContent();
}