In this article we will show how to connect discord to google sheets in just a few simple steps with the google sheets integration for slack and with Lido.
In the steps below we will set up a script to send a message to Discord whenever the sheet is edited. Here are the steps:
Discord webhooks allow you to push automated messages and data into a discord channel. To set one, hover the cursor over the channel name that you want to send messages to.
A gear icon will appear named Edit Channel. Click it.
After loading the channel settings, click Integrations in the left sidebar.
On the Integrations page, the option Webhooks is listed. Click Create Webhook.
A new webhook will be automatically generated. Click it to change its name and copy the URL.
We will come back to this page as we need the webhook url for the next step.
To start, click Extensions then select Apps Script.
A new tab will appear for Google Apps Script.
Delete the sample code in the code body, then copy the code from the following link:
https://github.com/rvbautista/google-sheets-alert-to-discord/blob/main/Code.gs
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.
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.
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.
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.
We hope this article has helped you and given you a better understanding of how to connect Google Sheets to Discord. You might also like our articles on how to connect Slack to Google Sheets and how to export Google Ads data to Google Sheets.
To optimize your workflow, we recommend reading our guide on how to extract a name from an email address in Google Sheets.