How to Monitor your Website's Uptime with Google Sheets
Would you like to receive instant email alerts as soon as your website goes down or is inaccessible to users? Most website monitoring services follow the “freemium” model - they have free plans for basic downtime and uptime monitoring of a website but you need to pay for unlimited email or SMS alerts. You may also need to upgrade to monitor multiple websites. There’s a good alternate though.
You can create your own website monitor that runs on Google servers and sends email alerts via Gmail when your website goes down or is back up and accessible again. The website monitor logs all events in a Google Spreadsheet or you can even choose to record store the uptime and downtime activity inside Google Analytics.
Here’s how you quickly configure Google Sheets to monitor the uptime /downtime of any public website. The setup has to be done just once and the Google Apps Script attached to the Google Spreadsheet will continuously monitor your sites in the background.
Let’s get started:
- Click here to copy the website monitoring Google sheet into your Google Drive.
- Go to the Website Monitor menu (near Help) and choose Configure. You may have to authorize the script the first time you configure the monitor.
- Specify your website URL and the email address where you wish to be notified. You can put multiple addresses separated by commas.
- This is option. Enter the Google Analytics Id (e.g., UA-123456-78) and the site monitor will log downtime / uptime events in your Analytics account.
Click the Start button and the Google sheet will start monitoring your website in the background. You may now close the sheet.
The uptime and downtime times are logged in theGoogle Spreadsheet so you can use that data to analyze the performance of your web hosting company.
If you would like to monitor more than one website with app, make a copy of the same Google Sheet and specify another website URL in the sheet.
Internally, a Google Script attached to the Google Sheet is doing the monitoring and logging events in Google Sheets and Google Analytics.
The script triggers every few minutes and then tries to fetch your website using URLFetchApp, a Google service similar to wget or curl. If the HTTP response code is anything other than 200, it indicates that there’s an issue with your website and an email alert is sent via the Gmail API.
A previous version of the script had the ability to send SMS text messages when your website goes down. The functionality is now removed since Google no longer support text alert notifications inside Google Calendar.
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.