Prompt Details
Model
Chat - (gpt-5.6)
Token size
351
Example input
[e.g. When a Google Form response arrives, automatically send the respondent a confirmation email, notify staff, and log the response in a spreadsheet]: When a Google Form response arrives, automatically send the respondent a confirmation email, notify staff, and log the response in a spreadsheet
[e.g. A response is submitted to a Google Form]: A response is submitted to a Google Form
[e.g. Form answers — name, email address, message]: Form answers — name, email address, message
[e.g. 1. A confirmation email to the respondent, 2. A notification email to staff, 3. One new row in a log sheet with a sequential receipt number and timestamp]: 1. A confirmation email to the respondent, 2. A notification email to staff, 3. One new row in a log sheet with a sequential receipt number and timestamp
Example output
/************************************************************
* GOOGLE FORM AUTOMATION
*
* What this script does:
* 1. Reads a submitted Google Form response.
* 2. Generates a sequential receipt number.
* 3. Adds the response to a log sheet.
* 4. Sends a confirmation email to the respondent.
* 5. Sends a notification email to staff.
* 6. Records processing errors in an "Error Log" sheet.
*
* IMPORTANT:
* - This script must be attached to the Google Form.
* - The Google Form must be linked to a response spreadsheet.
* - Change your settings in CONFIG below.
************************************************************/
/************************************************************
* SECTION 1: CONFIGURATION
*
* All settings that a non-programmer may need to change
* are collected here.
************************************************************/
const CONFIG = {
// The display name shown as the sender of emails.
SENDER_NAME: 'Form Response Team',
// Optional reply-to address. Leave blank to use the
// account that runs this script.
REPLY_TO_EMAIL: '',
// Email addresses that should receive staff notifications.
// Add one or more real email addresses before going live.
// Example: ['staff@example.com', 'manager@example.com']
NOTIFICATION_EMAILS: [],
// Subject of the confirmation email sent to the respondent.
RESPONDENT_EMAIL_SUBJECT:
'We received your message - Receipt {{RECEIPT_NO}}',
// Body of the confirmation email sent to the respondent.
// The four supported placeholders are replaced automatically.
RESPONDENT_EMAIL_BODY:
`Hello {{NAME}},
Thank you for contacting us.
We have successfully received your form submission.
Your receipt number: {{RECEIPT_NO}}
Date and time received: {{TIMESTAMP}}
Here is a copy of your submitted information:
{{ANSWERS}}
We will review your message and respond as appropriate.
Thank you.`,
// Subject of the notification email sent to staff.
STAFF_EMAIL_SUBJECT:
'New form submission - Receipt {{RECEIPT_NO}}',
// Body of the notification email sent to staff.
STAFF_EMAIL_BODY:
`A new Google Form response has been received.
Receipt number: {{RECEIPT_NO}}
Date and time received: {{TIMESTAMP}}
Respondent name: {{NAME}}
Submitted answers:
{{ANSWERS}}
Please review this submission.`,
// EXACT question titles from your Google Form.
// Do not change these unless you rename the form questions.
FIELD_TITLES: {
NAME: 'Name',
EMAIL: 'Email address',
MESSAGE: 'Message'
},
// Name of the sheet where successful submissions are stored.
RESPONSE_LOG_SHEET_NAME: 'Submission Log',
// Name of the sheet where processing errors are stored.
ERROR_LOG_SHEET_NAME: 'Error Log',
// Prefix used for automatically generated receipt numbers.
RECEIPT_PREFIX: 'R-',
// Number of digits in the numeric part of a receipt number.
// For example, 6 produces R-000001, R-000002, etc.
RECEIPT_NUMBER_PADDING: 6,
// Time zone used when displaying timestamps in emails.
TIME_ZONE: 'Asia/Tokyo',
// Address used by the test function.
// Enter an email address that you control.
// Both test emails will be sent to this address.
TEST_EMAIL: ''
};
/************************************************************
* SECTION 2: FORM SUBMISSION TRIGGER
*
* This function runs automatically whenever someone submits
* the Google Form.
*
* It receives the submitted answers, reads their timestamps,
* and passes the information to the main processing function.
************************************************************/
function onFormSubmit(e) {
let form = null;
let submittedAt = new Date();
let answers = {};
try {
// Make sure this function was called by a Forms submit trigger.
if (!e || !e.response) {
throw new Error(
'No form response was received. Check that the trigger is configured as "From form" -> "On form submit".'
);
}
// Get the form that generated this submission.
form = e.source || FormApp.getActiveForm();
// Get the original submission timestamp.
submittedAt = e.response.getTimestamp() || submittedAt;
// Read the answers using the exact question titles in CONFIG.
answers = extractAnswersFromFormResponse_(e.response);
} catch (error) {
// Record errors that occur while reading the form response.
recordErrorSafely_(
null,
form,
'',
'Read form submission',
error
);
// Do not hide the error. It will also appear in the
// Apps Script execution history.
throw error;
}
// Process the response and perform all required actions.
processSubmission_(answers, submittedAt, false, form);
}
By purchasing this prompt, you agree to our terms of service
GPT-5.6
Turn Google Form responses into automatic replies, staff notifications and a tidy log sheet, without replying by hand. Settings live in ONE CONFIG block, failures go to an Error Log sheet with the time, receipt number and full error text, plus a test function and setup steps. Note: Apps Script triggers usually fire within minutes but Google can delay them, so instant delivery is not promised. Built from this prompt and test-run end to end in a real account on 15 Nov 2026 with zero errors.
...more
Added 4 days ago
