# Google Forms

### Configuration <a href="#configuring" id="configuring"></a>

#### Setting up a MESA workflow with a Google Form <a href="#set-up" id="set-up"></a>

When you're setting up a MESA workflow with a Google Form, you will need to complete some steps in order for the workflow to work properly.

{% hint style="warning" %}
You will want to do this for every MESA workflow that has a dedicated [Google Forms trigger.](https://docs.getmesa.com/workflow-builder/triggers)
{% endhint %}

1\. While logged onto your preferred Google account, locate an existing form or create a new form: <https://docs.google.com/forms/u/0/?tgif=d>. If you are logged into multiple Google accounts, this link will use the first account that you are logged into so **please make sure that you are using the correct Google account.**

If you have an existing form, click on the form to edit it.

{% hint style="info" %}
🗒️ For first time Google Forms users, [you can refer to this guide for help with creating your first form.](https://support.google.com/a/users/answer/9303071?hl=en)
{% endhint %}

2\. Once you have a Google Form properly set up to your liking and while you are viewing the form, click on the three dotted icon from the top right hand navigation and click on **Script editor**.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2Fi1qXsShBwSbgnghglwGr%2FScreenshot_2024-05-15_at_2_37_09%E2%80%AFPM.png?alt=media&#x26;token=23ab537a-4eec-44d0-9821-a349b61ebdaa" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FI68gw7ACtVbDRkgY7zDh%2FScreenshot_2024-05-15_at_2_38_09%E2%80%AFPM.png?alt=media&#x26;token=6995ca62-7ff4-4cf2-a31d-bf80e059889a" alt=""><figcaption></figcaption></figure>

3\. In a new tab and back into your MESA workflow, click on your **Google Forms** trigger and click on the **Copy** icon next to the **Webhook Code** field.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FQKeNje3tbpbv0QCQ1bSZ%2FGetmesa%20Workflow%20-%20Step%202%20(1).png?alt=media&#x26;token=8726f11f-3e1a-4317-b047-559407ea1caa" alt=""><figcaption></figcaption></figure>

4\. Go back to the browser tab with the Google Script editor open.

5\. Locate where it says this in the editor

```
function myFunction() {

}
```

Erase everything in the editor.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FNKRnMouTPTHo8GtjCzRL%2FEF-google-forms-script-editor-code.png%20-%20Step%202.png?alt=media&#x26;token=9e74a93b-129d-4594-847e-e6446379cdf6" alt=""><figcaption></figcaption></figure>

6\. Then, paste what you just copied from the MESA workflow. It should look something like this in the editor:

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2Fgit-blob-d8f5c78b31ee57072440a5096310dcf442be2b75%2Ffile-x9cgc6hb1f.png?alt=media" alt=""><figcaption></figcaption></figure>

7\. After pasting, click on the floppy disk icon (from the editor's top navigation) which lets you save the code.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FJ7AiY3XKHE5WpX0qCevE%2FEF-google-forms-floppy-disk-copy.png%20-%20Step%202.png?alt=media&#x26;token=e3144b39-1697-499f-ae9c-20e249f53899" alt=""><figcaption></figcaption></figure>

8\. Above the floppy disk icon, click on **Untitled project** and rename the project to the name of your MESA workflow for organization purposes.

9\. On the left hand side bar, click on the clock icon labeled **Triggers.**

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2F9M23fXAyIAHdDy4pH3Qy%2FEF-google-forms-triggers.png%20-%20Step%202.png?alt=media&#x26;token=4f5a9b93-a1e6-48fe-ad48-c66860116ba6" alt=""><figcaption></figcaption></figure>

10\. On the Triggers page, click on the **+ Add Trigger** button.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FXfOQYeleeBVE2m5j1Wjc%2FEF-google-forms-add-triggers.png%20-%20Step%201%20(1).png?alt=media&#x26;token=c438e4c3-fb0b-4e4a-b639-4976a822d4d7" alt=""><figcaption></figcaption></figure>

11\. Locate the **Select event type** field on the prompted modal. Change the dropdown menu selection to: **On form submit**.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FfjgjJYzXehFOGveTSWjH%2FEF-google-forms-event-type.png%20-%20Step%202.png?alt=media&#x26;token=418a54bd-98c7-4389-89a5-c5507732d75c" alt=""><figcaption></figcaption></figure>

12\. After clicking **Save**, make sure that you are prompted with a new browser tab to sign into your Google Account. If you do not see a new browser tab after clicking Save, you may have disabled pop-up notifications so please check your notification settings as well.

13\. Once you log into your Google account, you will be prompted to grant Google access to your Form. Click on **Allow**.

14\. When viewing the **Triggers** page (mentioned in step 9), refresh the page and make sure that a trigger has been created with the Event set to: **From form - On form submit.**

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FP8wUiuZZ7cZhmnvijWAW%2FEF-google-forms-trigger-name.png%20-%20Step%202.png?alt=media&#x26;token=9a9b584a-82aa-4599-9f50-384d232b0c80" alt=""><figcaption></figcaption></figure>

15\. After confirming, you are all set! If you'd like to manually run your workflow with the Google Forms trigger, read the section below titled **Manually run your Google Forms workflow**.

#### Manually run your Google Forms workflow <a href="#test" id="test"></a>

To manually run your Google Forms workflow, make sure that you enable your workflow first. Then, make a test submission on your Google Form via URL or some other method!

The easiest method is to click on the **Send** button when viewing your Google Form.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2F9pTWVDa3IAV8EewDRGuQ%2FEF-google-forms-send-button.png%20-%20Step%202.png?alt=media&#x26;token=b6ef035d-87b1-4947-92f9-dce78fdc021a" alt=""><figcaption></figcaption></figure>

Then, click on the **Link** icon and click on **Copy**.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2F1qAtiA9ICVALSHZT7itU%2FEF-google-forms-link-copy.png%20-%20Step%202.png?alt=media&#x26;token=4865f90c-5682-4222-ad41-b3d78be25970" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FWUUTTOzOGRkGo81mHYEJ%2FEF-google-forms-link-copy.png%20-%20Step%203.png?alt=media&#x26;token=ef09ae97-b119-4d80-aac8-d34791a4a0b6" alt=""><figcaption></figcaption></figure>

You can paste the copied URL into a new browser tab and fill out the form there. Your workflow should then trigger whenever the form is submitted.

#### Using a form's response data <a href="#variables" id="variables"></a>

After your Google Forms workflow is triggered, you will most likely want to send the response data to a third party service (e.g. Google Sheet, Airtable). You can use [MESA variables](https://docs.getmesa.com/workflow-builder/fields/variables) in any of the later steps in your workflow. Variables are representations of data. When a workflow runs, variables are replaced with real data such as any of the data in the Form response.

If you have not already triggered the Google Forms workflow, you will see two variables associated to the Google Forms trigger by default. **Form ID** and **Submission ID**.

To select variables that represent data entered into your form's fields, you will need to trigger the workflow with all the available fields entered in. [Please read this section on how to manually run the workflow](#test).

Once the workflow is triggered, new variables will appear which will let you use them in later steps.
