# Row Updated (Advanced)

## Setting up

The Row Updated trigger requires additional configuration within your Google Sheet to work properly. Let's go through each step:

Begin by creating a new workflow in MESA and adding a Row Updated trigger. Under Step configuration, copy the App Script code.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FQwFg0mwGUPPVfMUT51d0%2Fimage.png?alt=media&#x26;token=bf7bd27f-075a-4844-a9e3-d0a3119eea04" alt=""><figcaption></figcaption></figure>

Go to your Google Sheet. Click on the “Extensions” menu option and select “Apps Script”.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2F3v3scyjXbR2ClbxwNIwg%2Fimage.png?alt=media&#x26;token=4e81f905-b485-4f61-98dc-3daf6cfc9291" alt=""><figcaption></figcaption></figure>

You should end up here:

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FE7pAA7BQOws2ht2xjahq%2Fimage.png?alt=media&#x26;token=9041c7ff-5abd-409a-873c-05e9767c98ff" alt=""><figcaption></figcaption></figure>

Paste the code from step 1, replacing the contents of the App Script file. It should look like this:

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FD72rAtV1inVBkXk6fWJw%2Fimage.png?alt=media&#x26;token=1f6d49d3-59f0-457a-a918-e6d1cb40a4a6" alt=""><figcaption></figcaption></figure>

Save your changes.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FY4tADIKNmvhLzpViXAyF%2Fimage.png?alt=media&#x26;token=c7570f12-59bd-410e-9add-0a304a638b5c" alt=""><figcaption></figcaption></figure>

The last thing we have to do is to setup a trigger. In order to do that we need to click on the clock icon on the left hand side (in the Google Script editor).

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FFtyq9lagUTs1E9zqqR9S%2Fimage.png?alt=media&#x26;token=bbddc02f-949c-4b5f-9cd5-2f2a7a92f01c" alt=""><figcaption></figcaption></figure>

Click "create a new trigger” on the Triggers page.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FVtqTYTXppS8eKvXQ7AFr%2Fimage.png?alt=media&#x26;token=4618681d-274f-40a9-af96-acc38bc55e31" alt=""><figcaption></figcaption></figure>

The only thing we need to edit in the window that pops up is under “Select Event Type”, set that to “On change” and Save.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FeZNcSnbcAdZEEnC7rgyz%2F1_HAvWE5V6YFZXDGTuZ_iL0w.gif?alt=media&#x26;token=fbcbae90-4e88-4dc2-8490-7d3543e537f6" alt=""><figcaption></figcaption></figure>

You will be asked to approve this trigger via the standard Google authorization flow. Choose the correct Google account and grant access.

Your Row Updated trigger has now been configured.  Enable your workflow in MESA and edit your spreadsheet. Confirm that your workflow is getting triggered successfully in the Activity tab.

## Variables available

The Row Updated step will not have any [variables](https://docs.getmesa.com/workflow-builder/fields/variables) available until you have set up the App Script in Google Sheets and run at least one [manual run](https://docs.getmesa.com/workflow-builder/testing) or live run. To update the variables available after updating column headers, simply make another update in your spreadsheet and refresh the builder. MESA will automatically make the columns from your latest run available in the Variable Selector.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FLCZ8bKeIHUZcxNNZT4A4%2Fimage.png?alt=media&#x26;token=d61a2918-2dbc-4c43-8859-fbc78427aee6" alt=""><figcaption></figcaption></figure>
