Once you copied the code, paste it to the Apps Script code area. Edit the code to replace the following:
discord_webhook: the webhook URL to the Discord channel. To get it, go back to the tab where you have the webhook open, then click Copy Webhook URL.
Go back to Apps Script. The line where you need to add the webhook is in line 8:
Once you are done, click the Save button.
3. Install a Trigger to Run the Script
We also need to install a trigger to ensure the script runs correctly. In the Apps Script tab, hover your cursor over the left sidebar. A list will appear. Click Triggers.
The list of triggers will appear. Click Add Trigger on the lower-left corner of Apps Script.
A box labeled Add Trigger for Untitled project will appear. Use the following settings:
Choose which function to run: onEdit
Choose which deployment should run: Head
Select event source: From spreadsheet
Select event type: On open
Failure notification settings: Notify me daily
Click Save afterwards.
4. Authorize the Script
You will need to authorize the script first. A new window will be loaded asking you to choose a Google account. Most of the time, only the account you are using to create the sheet will be listed. Select it.
A warning saying that Google hasn’t verified the app will appear. Click the link labeled Advanced at the bottom of the message. A link labeled Go to Untitled project (unsafe) will appear. Click it.
A list of permissions needed by the app will be listed next. Click Allow.
The window will close and you will be brought back to the Google Sheets. The trigger you set will now appear listed.
5. Run the Script
Hover your cursor to the left sidebar again, then click Editor.
Click Run the selected function.
After running the function, you can now close the Apps Script tab and go back to Google Sheets tab. When you do an edit, it will send a notification to Discord containing the sheet name and the cell or range you edited:
Now you have connected google sheets to discord.
Tired of constantly monitoring your spreadsheets? Scale operations with Lido automations and free up time to focus on what really matters.