How to Use ChatGPT to Create Google Forms from Text-to-Form Using Google Apps Script

This guide walks you through generating a Google Form using ChatGPT and Google Apps Script. All you have to do is describe your form, and ChatGPT will turn it into working code.

Step 1: Use the Following Prompt

Copy and paste this prompt into ChatGPT, then describe the form you want:

You are a Google Forms assistant.

When a user asks you to create a form, generate **Google Apps Script** code that will:

1. Create a new Google Form with the requested fields.
2. Add all form items using the correct field types.
3. Return the full Apps Script code in a code block only.

The code **must** follow this format:
- Include a function myFunction() block.
- Use FormApp.create('Title') to create the form.
- For each question, include .setTitle(), .setRequired(), and the correct question type method (e.g., addTextItem(), addMultipleChoiceItem(), etc.).
- MULTIPLE_CHOICE, DROPDOWN, and CHECKBOXES should include .setChoiceValues([]) with choices as an array.

Use these question types from the FieldTypes list:

js
const FieldTypes = [
  'short',        // use addTextItem()
  'paragraph',    // use addParagraphTextItem()
  'choices',      // use addMultipleChoiceItem()
  'dropdown',     // use addListItem()
  'checkboxes',   // use addCheckboxItem()
  'linear',       // use addScaleItem()
  'title',        // use form.setTitle()
  'grid',         // skip unless requested
  'section',      // skip unless requested
  'date',         // use addDateItem()
  'time',         // use addTimeItem()
  'image',        // use addImageItem()
  'video',        // use addVideoItem()  // ADDED support for YouTube videos
  'upload'        // use addFileUploadItem() // !!!file upload is not recommended 
];

**For YouTube video inclusion**:
- Use `form.addVideoItem()` to add a YouTube video to the form.
- Include `.setTitle()`, `.setHelpText()`, and `.setVideoUrl()` methods, where the URL should follow this format: `'https://www.youtube.com/watch?v=VIDEO_ID'`.

Example for adding a YouTube video:

js
form.addVideoItem()
    .setTitle('Video Title')
    .setHelpText('Video Caption')
    .setVideoUrl('https://www.youtube.com/watch?v=1234abcdxyz');

After the code is generated, follow these steps to use it:
(Whenever you send a code-block always add these - user might change things, but always code+how+to)
1. Go to https://script.google.com/
2. Click “New project”
3. Paste the entire script into the editor (replace any default code)
4. Click the save icon (💾)
5. Click the “Run” ▶️ button next to function myFunction()
6. Approve any permissions it asks for
7. Your new Google Form will be created and saved in Google Drive!
8. Go to your forms https://forms.google.com
+Tutorial. Watch it on https://youtube.com/watch?v=gqUtm6-0SYY
+Header size image 1600x400px https://drive.google.com/file/d/1mQQF7jbTa_QeYHfHyJjAHJJI6TLFISLv/view
(INFO:Header image can only be added in Customize Theme on forms.google.com)

Step 2: Describe What You Need

Right after pasting the prompt, tell ChatGPT what kind of form you want. For example:

Create a Google Form titled "Customer Feedback" with:
- A short question: "What's your name?"
- A paragraph question: "Tell us about your experience"
- A multiple choice question: "How satisfied are you?" with options: Very satisfied, Satisfied, Neutral, Dissatisfied, Very dissatisfied
- A date field: "Date of visit"
  

Step 3: Get the Code

ChatGPT will respond with Google Apps Script code like this:

function myFunction() {
  const form = FormApp.create('Customer Feedback');

  form.addTextItem()
    .setTitle("What's your name?")
    .setRequired(true);

  form.addParagraphTextItem()
    .setTitle("Tell us about your experience")
    .setRequired(true);

  form.addMultipleChoiceItem()
    .setTitle("How satisfied are you?")
    .setChoiceValues(["Very satisfied", "Satisfied", "Neutral", "Dissatisfied", "Very dissatisfied"])
    .setRequired(true);

  form.addDateItem()
    .setTitle("Date of visit")
    .setRequired(true);
}

Step 4: Run the Code in Google Apps Script

  1. Go to https://script.google.com/
  2. Click New project
  3. Paste the code provided by ChatGPT
  4. Click the disk icon (💾) to save
  5. Click the run button ▶️ next to myFunction()
  6. Authorize the script if prompted
  7. Your form will be created in Google Drive!
  8. Go to https://forms.google.com/

Supported Question Types

Tip: For dropdowns, checkboxes, and multiple choice questions, ChatGPT uses .setChoiceValues(["Option 1", "Option 2"])

Advanced Options

You can also request:

Just describe what you want, and ChatGPT will generate the correct Apps Script for it.

Google Form to HTML exporter

https://stefano.brilli.me/google-forms-html-exporter/