Skip to content

Scheduling automatic Google Sheets changes

by manuel on January 29th, 2017

I have a weekly schedule for our rotations at the hospital in Google Sheets. It usually contains the schedule for the next two months. The problem was that one always had always to search for the current week… So I thought there should be a way to automatically hide past weeks from the sheet. In fact, this can be achieved by using Google Scripts.

On Google Sheets, go to Tools > Script editor… and add this script:

Change the sheet ID and sheet name, the starting date (d1) and the number of rows to hide each week (17 in my case).

Basically what the script does is it calculates the weeks elapsed from d1, multiplies this by the number of rows to hide and hides the rows.

To make it run automatically, in Google Script, go to Edit > Current project’s triggers, and add a new trigger: Time-driven / Day timer / From 1-2 am.

That’s it! The script should run every day between 1-2 am and on Saturday, the last week will be hidden, so that the first week is always the current one.

From → Useful stuff

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS

*