Track Flights to Google Sheets

Flight track from Paris to San Francisco

I built my ideal flight tracker from bitter experience. Planes, of course, leave late or arrive early. They often drop off tracking for an hour or more, especially on polar routes. You might also forget to download a track while exhausted after a long trip and then it's unavailable by the time you remember to go back and look at it.

This Google Apps Script project uses the FlightAware API to make this a hands off process. You just put your flights in a spreadsheet in advance and come home to a folder of tracking data. If a flight stops tracking, the script projects its path on a great circle route to the destination airport. When tracking comes back online the script recomputes the projected data to the new good location, leaving you with the best possible version of the data.

(I'm about to leave on a trip that will take me all around the planet - the third time I will have done this, and hopefully the first with an excessively accurate GPS track as a souvenir).

In Google Drive create a new spreadsheet with a Flights tab, and a folder to store the flight tracks. Sign up for the FlightAware AeroAPI and grab an API key. Check that you're comfortable with the pricing - I find it's pretty reasonable for personal use. Once that's ready, create a Google Apps Script project and paste the following script into Code.gs:

I'm not including the code here, but you'll also need this script for airport locations. Add an Airports.gs file to the same project and paste it in.

Edit Code.gs to add your API key, the configuration spreadsheet, and the folder for flight tracks.

Finally, run the setup function from the Apps Script debugger. You'll be prompted to authorize the script, and a sample row will be added to the configuration spreadsheet in the Flights tab. The script will also be scheduled to run every ten minutes. You can now add upcoming flights to the spreadsheet. Once you've got this far, I recommend adding a test flight to make sure everything is working before tracking something that you care about.

This is the first Apps Script project I've released that is 100% written by Claude Code - I didn't touch a line of it. I'm sharing because of my painful experience with flight tracks that didn't meet my needs, and the extensive product management process of smoking out edge cases and testing until I had a solution that really works. The image above is a test track from Paris to San Francisco (a randomly chosen flight while I was debugging) and it has two sections where data dropped - the end result captures the actual route as far as possible and I'm really happy with the result.

Enjoy, and leave any questions in the comments.

Robert Ellison's blog, I Thought He Came With You, on the Fediverse via fed.brid.gy. Photography, time lapse, programming, politics, hikes and more.

Add Comment

All comments are moderated. Your email address is used to display a Gravatar and optionally for notification of new comments and to sign up for the newsletter.