A simple Google Apps Script to send bugdet alerts via email based on a spreadsheet.
The basic instructions provides you with a sheet you can copy that includes the basic script The advanced instructions allows you to link with your own sheet and keep a separate script. If you know what you're doing, go for these instructions
- Create a copy of https://docs.google.com/spreadsheets/d/1IURgnLjAivPTwHcCjtlANPaFGl8X0pH8I-O-Qzfpey8 on your personal gdrive
- Open the sheet and click on script editor.
- Fill in the BUDGET_SHEET with the ID of the google sheet you just copied (the one on your drive)
- Fill in the email properties
- RECIPIENTS to be your email address
- SENDER_NAME as per your preference
- REPLY_TO to be either your email address or a no-reply address in your domain
- EMAIL_SUBJECT as per your preference
- Click on select function, select "sendNotifications" and click on the run icon
▶
- Allow the app to run on your file by following Google's security prompts.
- Verify your email. You should have received your first notification!
- Go back to the budget sheet and modify the balues on the columns. Please keep month names in English (as per the dropdown validation) or update the script if you translate them.
- Schedule the script to be run on your prefered basis by clicking on the
Current project triggers
icon (🕑).- Click on
Add a trigger
- Change
event source
toTime-driven
- Adjust your scheduling preferences
- Click on
- Copy the ExpenseBudgetAlert.js content into a new GAS project
- Create a spreadsheet with a sheet named
Yearly
and the layout (and month names) as this one https://docs.google.com/spreadsheets/d/1IURgnLjAivPTwHcCjtlANPaFGl8X0pH8I-O-Qzfpey8 or update your script with your month's names and column indexes. Check this codevar expenses = []; var range = spreadsheet.getSheetByName('Yearly').getDataRange().getValues(); for(var i = 0; i < range.length; i++) { var month = range[i][1]; var _cur = range[i]; expenses.push(new Expense(_cur[0], _cur[1], _cur[2], _cur[3])); }
- Fill in the BUDGET_SHEET with the ID of the google sheet you just created
- Fill in the email properties
- RECIPIENTS to be your email address
- SENDER_NAME as per your preference
- REPLY_TO to be either your email address or a no-reply address in your domain
- EMAIL_SUBJECT as per your preference
- Click on select function, select "sendNotifications" and click on the run icon
▶
- Allow the app to run on your file by following Google's security prompts.
- Verify your email. You should have received your first notification!
- Schedule the script to be run on your prefered basis by clicking on the
Current project triggers
icon (🕑).- Click on
Add a trigger
- Change
event source
toTime-driven
- Adjust your scheduling preferences
- Click on