Automatically Log Daily YouTube Analytics to Google Sheets
An n8n workflow that pulls yesterday's views, watch time and subscriber change from the YouTube Analytics API every morning and appends them to a Google Sheet — giving creators a growing dashboard of channel performance without ever opening YouTube Studio.
- 1
Set up the OAuth2 credential
In Google Cloud, enable the YouTube Analytics API and create an OAuth2 client. In n8n, add a
Google OAuth2 APIcredential with scopehttps://www.googleapis.com/auth/yt-analytics.readonlyand authorize it. This lets n8n read your private channel metrics securely. - 2
Schedule the morning run
Add a
Schedule Triggerset toDaysat hour6. Reporting one day behind is normal — YouTube finalizes yesterday's numbers overnight, so a 6 AM run captures clean, settled data. - 3
Query the Analytics API
An
HTTP Requestnode (using the OAuth2 credential) callshttps://youtubeanalytics.googleapis.com/v2/reportswithids=channel==MINE,startDateandendDateboth set to yesterday via{{$today.minus({days:1}).toFormat('yyyy-MM-dd')}}, andmetrics=views,estimatedMinutesWatched,averageViewDuration,subscribersGained,subscribersLost. - 4
Shape the row
A
Setnode maps the API'srows[0]array into named fields — date, views, watch minutes, avg view duration, subs gained, subs lost, and a computednet_subs. Naming them here keeps the Sheet columns tidy and self-documenting. - 5
Append to your dashboard sheet
A
Google Sheetsnode appends the row. Insert a line chart over the date/views columns once and it grows automatically. You now own a permanent, exportable record of channel growth independent of YouTube Studio's rolling windows.
Frequently asked questions
Why is this rated Advanced?
The YouTube Analytics API needs OAuth2 (not just an API key) because it reads private channel data. Setting up the OAuth consent screen and credential in Google Cloud is the fiddly part. Once the n8n OAuth2 credential is connected, the rest of the workflow is straightforward HTTP + Sheets.
Which metrics can I pull?
The reports endpoint supports dozens: views, estimatedMinutesWatched, averageViewDuration, subscribersGained, subscribersLost, likes, comments, shares and more. The example pulls the core five, but you just extend the `metrics` query parameter with a comma-separated list to track whatever you care about.
Can I chart the results automatically?
Google Sheets can build a live chart from the growing range with no extra setup — insert a chart once and it expands as rows append. If you'd rather push to a BI tool, add a second branch that also writes to BigQuery or sends the row to a Looker Studio data source.