This guide will help you set up Google Sheets integration for the Instagram Message Tracker.
The Google Sheets integration allows you to:
- Read Instagram usernames directly from a Google Sheet
- Automatically update the sheet with tracking results (status, timestamp, reply preview)
- No need to download/upload CSV files manually
- A Google account
- The Google Sheet you want to use must have an "instagram" column (case-insensitive)
- Go to Google Cloud Console
- Click "Select a project" at the top, then "New Project"
- Name your project (e.g., "Instagram Tracker") and click "Create"
- In the Cloud Console, go to "APIs & Services" > "Library"
- Search for "Google Sheets API"
- Click on it and click "Enable"
- Also search for and enable "Google Drive API"
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "Service Account"
- Name it (e.g., "instagram-tracker-service")
- Click "Create and Continue"
- Skip the optional steps and click "Done"
- On the Credentials page, find your service account and click on it
- Go to the "Keys" tab
- Click "Add Key" > "Create new key"
- Choose "JSON" format and click "Create"
- A JSON file will be downloaded to your computer
- Rename the downloaded JSON file to
google_credentials.json - Move it to the root directory of this project (same folder as
app.py)
Important: The file MUST be named exactly google_credentials.json
- Open your Google Sheet
- Click the "Share" button in the top right
- Open the downloaded
google_credentials.jsonfile - Find the
client_emailfield (looks like:xxx@xxx.iam.gserviceaccount.com) - Copy thi s email address
- In your Google Sheet, paste this email in the "Add people and groups" field
- Give it "Editor" permissions
- Click "Send"
Your Google Sheet must have:
- An "instagram" column (can be "Instagram", "INSTAGRAM", etc. - case doesn't matter)
- Instagram usernames in any of these formats:
username@usernamehttps://instagram.com/usernameinstagram.com/username
Example sheet structure:
| Name | Instagram | Email |
|---------------|---------------------|---------------------|
| John Doe | @johndoe | john@example.com |
| Jane Smith | janesmith | jane@example.com |
| Bob Wilson | instagram.com/bob | bob@example.com |
- Start the Flask app:
python app.py - Go to the dashboard (usually http://localhost:5000)
- Select "Google Sheets URL" from the Input Method dropdown
- Paste your Google Sheets URL (e.g.,
https://docs.google.com/spreadsheets/d/abc123.../edit) - Enter your Instagram credentials
- Click "Track Messages"
The app will:
- Read usernames from your sheet
- Track the message status for each username
- Automatically add 3 new columns to your sheet:
- "Tracking Status" (Not Seen / Seen / Replied)
- "Tracking Timestamp"
- "Reply Preview"
- Make sure
google_credentials.jsonis in the same folder asapp.py - Check the file name is exactly
google_credentials.json(case-sensitive)
- Verify the JSON file is valid and not corrupted
- Make sure you enabled both Google Sheets API and Google Drive API
- Make sure you shared the sheet with the service account email
- The email address should be from the
client_emailfield in the JSON file - Give it "Editor" permissions
- Add a column with "instagram" in the name (any case)
- Make sure the column has Instagram usernames in it
- NEVER commit
google_credentials.jsonto version control (Git) - Add it to your
.gitignorefile - Keep the credentials file secure - it provides access to your Google Sheets
- If compromised, delete the service account and create a new one
# Google Sheets credentials
google_credentials.json