1 post about #productivity

Build Google Forms with Apps Script

You can create a fully customized Google Form programmatically using Google Apps Script

Instead of manually designing forms, you can write a script to:

  • Automatically generate a form with multiple sections and questions.

  • Add various question types like text, multiple choice, or checkboxes.

  • Retrieve and log the link to the form for easy sharing.

Here’s an example:

function createTILGoogleForm() {
  // Create a new Google Form
  const form = FormApp.create('Today I Learned Form');
  form.setDescription('A quick example of how to create a Google Form with Apps Script.');

  // Add a section and some questions
  form.addSectionHeaderItem().setTitle('Your TIL Entry');
  form.addTextItem().setTitle('What did you learn today?');
  form.addParagraphTextItem().setTitle('How might you use this knowledge in the future?');

  // Log the form's URL
  Logger.log('Form created! Access it here: ' + form.getPublishedUrl());
}

Steps to create the Google Form using a script:

  1. Open Google Drive and create a new Google Apps Script:
  • Go to New > More > Google Apps Script
  1. Write your script or copy mine, into the Script editor

  2. Save and run the script

When you run the script:

  1. A new Google Form titled “Today I Learned Form” will be created in your Google Drive.

  2. The form’s link is logged in the Apps Script console for sharing.

Why this is cool:

  • Saves time on repetitive tasks.

  • Perfect for automating form creation for surveys, feedback collection, or team updates.

Next time you need to create a form, think about scripting it instead of clicking through the interface