Log business miles from Google Calendar jobs (Maps + Sheets)
Every job on your calendar with an address becomes a dated mileage row at the right 2026 IRS rate, so there's no end-of-year reconstruction.
The problem
You drive to jobs all week. Come tax time (or an audit), you're supposed to have a log made at or near the time of each trip: date, where you went, business purpose, and miles. Apps like MileIQ help, but plenty of owners still rebuild a year of trips from memory or skip the deduction. If the address is already on your Google Calendar, you shouldn't have to type it again.
What it does
Every evening the workflow reads today's Google Calendar events that have a location. It skips cancelled events and anything tagged personal / PTO / vacation. For each job stop it asks the Google Maps Routes API for the driving distance from your shop (or from the previous stop, in chain mode), converts meters to miles, applies the IRS standard mileage rate for that date (72.5¢ a mile through June 30, 2026; 76¢ from July 1, 2026), and appends a row to a Google Sheet. Odd results (no route found, a Maps error, zero miles, a trip over 200 miles, or a trip in a year your rate settings don't cover) are marked needs_review and you get an email. The same calendar event isn't logged twice.
- Import
calendar-mileage-auto-log.n8n.json. - Open Your settings and fill in BUSINESS_NAME, OWNER_EMAIL, FROM_EMAIL (on a domain you verified in Resend), HOME_BASE (your shop or home-office address, the way you'd type it into Google Maps), MAPS_API_KEY, TRIP_MODE (
round_trip,one_way, orchain), and SKIP_KEYWORDS. RATE_H1 (0.725), RATE_H2 (0.76), RATE_CUTOVER (2026-07-01), and REVIEW_OVER_MILES (200) are set to the 2026 IRS business rates. When the IRS publishes next year's rate, set RATE_H1 and RATE_H2 to it and RATE_CUTOVER to that year's January 1 (for example2027-01-01). Until you do, trips in the new year are flaggedneeds_reviewrather than logged at the wrong rate. - On Get today's calendar events, add a Google Calendar OAuth2 credential and pick the calendar your jobs live on (often
primary). It pulls today's events with recurring jobs expanded into single occurrences. - In Google Cloud, on a project with billing turned on, enable the Routes API, create an API key restricted to that API, and paste it into MAPS_API_KEY. (The older Distance Matrix API is now a Legacy service that new Cloud projects can't turn on, which is why this recipe uses Routes.) Each leg is one Compute Routes request with no traffic options, billed under the Essentials SKU. That SKU includes 10,000 free requests a month, so 5 stops a day stays well inside it.
- On Add to mileage sheet, add a Google Sheets credential and pick a blank sheet. The first row it writes creates the column headers (Trip Date, Event, Purpose, Origin, Destination, Leg, Miles, Rate, Deduction, Status, Review Notes, …).
- On Email me: mileage to check, add a Header Auth credential for Resend (
Authorization: Bearer <key>). - Put a real address on a test calendar event for today, run the workflow once, check the sheet, then activate. The schedule fires daily at 6 PM in your n8n timezone. Events later that evening are still picked up because it reads the whole day, but if you often add jobs after 6 PM, move the trigger later.
How it decides: round_trip (default) measures home→job and doubles it (shop→job→shop). one_way logs only home→job. chain sorts today's stops by start time and logs home→job1, job1→job2, …, last→home, which is closest to a real day on the road. Events without a location, cancelled events, and anything whose title, location, or description matches SKIP_KEYWORDS are ignored. A row is auto only when Maps returns a route, the miles are above 0 and at or under REVIEW_OVER_MILES, and the trip date falls in the year your rates are set for. Everything else is needs_review with a plain reason.
Credentials: Resend uses generic Header Auth. The Maps key lives in Your settings (restrict it to the Routes API and, if you can, to your n8n server's IP). Settings live in the Your settings node rather than environment variables, so this works on n8n Cloud and on self-hosted n8n 2.x, where env access from workflows is blocked by default. Skip repeat event legs remembers event IDs between runs, so a manual re-run won't double-log a day.
Make / Zapier notes
Dedicated mileage apps (MileIQ, Everlance, Stride) still win if you need GPS that catches unplanned stops. Use this recipe when your jobs already have addresses on Google Calendar, you want a sheet that you and your bookkeeper both own, and you want the 2026 mid-year rate change applied automatically. Pair it with Turn receipt photos into an expense log for the rest of the vehicle paper trail: business parking fees and tolls are deductible on top of the standard mileage rate, while gas and repairs are already built into the rate.
Make and Zapier both handle the Maps + Sheets path well. n8n is the easiest place to get round-trip vs chain logic, event-ID dedupe, and the review email in one workflow.
Compliance notes
This is record-keeping, not messaging. The only email goes to you, so CAN-SPAM and TCPA don't apply. The IRS requires adequate records for car expenses (Topic no. 510, Topic no. 305). Publication 463 (chapter 5) asks for the miles of each business use, the date, and the business purpose, plus total miles for the year, so log your odometer on January 1 and December 31 too. 2026 business rates: 72.5 cents a mile Jan 1–Jun 30 and 76 cents a mile Jul 1–Dec 31 (IRS standard mileage rates; the mid-year increase is Announcement 2026-11). Rules that trip people up (Topic 510): for a car you own, you have to choose the standard mileage rate in the first year the car is used for business; for a leased car, you have to stick with it for the whole lease; and you can't use it if you run five or more cars at the same time. Miles here are Google's estimate for the suggested route, not a GPS or odometer reading, so fix any row that doesn't match the drive you actually made. Keep the sheet private. This is not tax advice; your CPA has the final say.
Expected result
By Friday you already have the week's mileage log instead of a January scavenger hunt. Most rows come through as auto. You spend a few minutes on the needs_review ones (a wrong address on the calendar, a Maps miss), and at tax time you hand over one sheet with date, purpose, miles, rate, and deduction.
Workflow file: calendar-mileage-auto-log.n8n.json