Automate calendar, spreadsheet updating based on email sent from work.
Warning: This is not a replacement for reading your work email. You are still responsible for checking your email and knowing your schedule. This is merely an aid.
There are two ways to install this system.
Option 1:
Copy the code from the files directly and save with .gs file extention in Google Script
-
Login and create a new Project.
-
Create and copy files.
From the folder calledsimple
copy the files as named. Remember to renamedconfiguration.js.sample
toconfiguration.gs
Note: the file extension will be changed from .js to .gs in Google. -
Setup the configuration.gs file to match your needs.
Note: You can use your gmail address for the calendarID if you want to use your primary calendar.
It should be noted that I am using labels in this configuration. You should be filtering your email and applying a label to your work schedule email. In this case I have a parent label:Berlitz
and a sub-labelSchedule
. I will not go into details on how to do this since there is plenty of online guides. But if you need a hint. Your filter might look like this:from:(advantage-noreply@) to:([email protected]) subject:(Schedule for)
and have that filter apply the label you wish to use.Sample: Without Spreadsheet.
const spreadSheetID = ""; const calendarID = "[email protected]"; const restDay = "Monday"; // Set your Rest day here const nightlyFilter = "newer_than:1d AND label:Berlitz/Schedule AND -label:ProcessedSchedule"; const updatedFilter = "newer_than:1d AND label:Berlitz/Schedule AND label:ProcessedSchedule"; // Check locations.js for valid LC names. const baseLC = "Akasaka"; // Set your Base LC here const writeSpreadSheet = false; const showMaterial = true; const archive = true; const contractType = "PL";
Sample: With Spreadsheet.
const spreadSheetID = "YOUR_SPREADSHEET_ID"; const calendarID = "[email protected]"; const restDay = "Monday"; // Set your Rest day here const nightlyFilter = "newer_than:1d AND label:Berlitz/Schedule AND -label:ProcessedSchedule"; const updatedFilter = "newer_than:1d AND label:Berlitz/Schedule AND label:ProcessedSchedule"; // Check locations.js for valid LC names. const baseLC = "Akasaka"; // Set your Base LC here const writeSpreadSheet = true; const showMaterial = true; const archive = true; const contractType = "PL" or "FTI";
-
(Optional) Setup a daily trigger to run some time after the schedule has been posted. See instructions Here
Option 2:
For those with software development experience or the bold of heart. :)
Clone this repo and then use clasp
to push the code to GoogleScript. See Video Here for a guide on getting started.
cd code
After setting up the .clasp.json you can simply do
clasp push
You will need to create or use an existing calendar and determine its ID. You can get the ID by opening your google calendar.
If you want to have a special calendar for your Berlitz work schedule. Follow these steps after creating the calendar in Google.
- Navigate to Calendar and click on the three vertical dots
- Select "Settings and Sharing"
- Below Integrate Calendar
The ID will be just blow this text.
You will need to create a spreadsheet in your google drive and get its ID. The ID can be found in the spreadsheet's url located between d/SPREADSHEET_ID/edit#gid=0
A sample spreadsheet is located here
You can copy this sample to your own google drive account.
You will need to set your configuration options using the the above details.
(This step is optional)
In order for this to be automated. You need to set up a trigger that runs by itself.
- Open your project and select 'Edit' -> 'Current Project Triggers'
- Click on the 'Add Trigger'. Its a nice large blue Button, probably in the lower right corner.
- 'Select type of time based trigger' Set this to 'Day timer'. I have mine set to sometime after 7pm.
- Select the time window for execution. 'Select time of day'
-
Berlitz has not created all the required Google Maps entries for all Language Centres, more over, there are barely any locations in Apple Maps. This means that the maps location may not be available. If you find an LC that does have a Google maps location but no entry in the locations.gs file. Please let me know.
-
You may need to reauthorize the app after a few months. This happened to me after I had been using it for 4 to 5 months.