You sometimes would like to remind something from Google Sheets you usually manage if you are a heavy Google Sheets user.
I'll introduce how to make a reminder that posts messages from Google Sheets to Slack.
This video shows our goal in this tutorial.
Prerequisites
You need to follow the below prerequisite before you start this tutorial.
- Create a new sheet in Google sheets
- Create a workspace or join an existing workspace in Slack
- Use gas-sheets2slack
Settings of Google Sheets
Create a sheet to post messages to Slack.
Notification | Title | Content | Url |
---|---|---|---|
2022/08/29 | Sample title | This is a sample text. | https://dev.to/ |
Open Apps Script from within Google Sheets.
📖 Lean more Extending Google Sheets
Get the script ID in Apps Script.
⚠️ Save the ID to use it in development.
Settings of Slack apps
Open https://api.slack.com/apps and click “Create New App”.
Select "From scratch".
Set up display information as you want.
In your left sidebar, navigate to "Incoming Webhooks" and then activate it.
Add new webhook to workspace and copy webhook URL.
⚠️ Save the webhook URL to use it in development.
Google Apps Script
We want to use Apps Script to post messages from Google Sheets regularly.
I prepared a template for this project, so you don't have to spend extra time to develop.
1. Clone template
Open the repository and click Use this template.
Clone the repository and install dependencies.
yarn install
2. Login Google account
Authorize management of your Google account's Apps Script projects.
yarn clasp login
3. Create files
Create a .clasp.json at the root, and then add these settings.
Open App script from your spreadsheet and check out a script Id at the setting page.
{
"scriptId": "<SCRIPT_ID>",
"rootDir": "./dist"
}
Create a .env at the root, and then add "SLACK_WEBHOOK_URL".
SLACK_WEBHOOK_URL=<SLACK_WEBHOOK_URL>
4. Upload a script project
Upload your script project's files from your local with this command.
yarn deploy
Click "Add trigger" from the trigger menu.
Set up these options like this.
Apps Script finds out if the list has a notification date the same as today from your sheet every day.
Apps Script posts a message when it finds out the date same as today.
Run Apps Script
Run "main.gs" in the editor menu and check out if you can receive a message in your slack channel.
Conclusion
I hope this tutorial will help you to enhance your reminder flow.
Top comments (0)