Watch YouTube videos from inside Google Sheets — a small cloud service that turns a video ID into a shareable Google Drive link.
StreamSheet is the back end for watching YouTube from a Google Sheet. Send it a YouTube video ID and it checks the video, downloads it at up to 720p, uploads it to Google Drive and hands back a Drive link anyone can open — so a spreadsheet can list videos and play them from Drive.
- One simple endpoint —
POST /downloadwith avideoId, get back a Google Drive viewing link. - Safety checks first — uses the YouTube Data API to make sure a video is public, embeddable and not age-restricted before downloading anything.
- Sensible quality — downloads the best video up to 720p plus audio, merged into a single MP4 named after the title and channel.
- Size guards — rejects broken downloads (under 1 KB) and anything over 500 MB.
- Auto-sharing — uploads to Drive with a service account and makes the file readable by anyone with the link.
- Cleans up after itself — temp files are deleted once uploaded; a
/test-accessroute checks the Drive connection.
flowchart LR
S[Google Sheet] -- videoId --> F[Flask /download]
F --> Y[YouTube Data API<br/>public? embeddable? age-restricted?]
Y --> D[yt-dlp + FFmpeg<br/>≤720p MP4]
D --> G[Google Drive API<br/>upload + share]
G -- Drive link --> S
It runs as a small container (Python 3.11 slim with FFmpeg), with a Procfile for one-click
hosting on platforms like Heroku/Railway.
Set two environment variables:
| Variable | What it is |
|---|---|
YOUTUBE_API_KEY |
A YouTube Data API v3 key |
SERVICE_ACCOUNT_JSON |
The JSON key of a Google service account with Drive access |
Run with Docker:
docker build -t streamsheet .
docker run -p 5000:5000 -e YOUTUBE_API_KEY=... -e SERVICE_ACCOUNT_JSON='{...}' streamsheetOr locally: pip install -r requirements.txt && python main.py (needs FFmpeg). Then:
curl -X POST http://localhost:5000/download -H "Content-Type: application/json" -d '{"videoId":"dQw4w9WgXcQ"}'- Python 3.11, Flask
- yt-dlp + FFmpeg
- YouTube Data API v3, Google Drive API v3 (service account)
- Docker