Master to Sibling Smartsheet Function¶
Master to Sibling Smartsheet Function
Python script that replicates data from a master Smartsheet to multiple sibling sheets, maintaining data consistency across related sheets.
Overview¶
This repository provides a Python-based solution for the master-sibling sheet pattern, where data from one authoritative "master" sheet needs to be replicated to multiple "sibling" sheets. Perfect for scenarios where multiple teams need read-only copies of centralized data.
GitHub Repository: JFlo21/master-to-sibling-smartsheet-function
Key Features¶
Use Cases¶
- Distributing centralized reference data to teams
- Creating department-specific views of master data
- Maintaining synchronized project information across teams
- Replicating approved data to execution sheets
Architecture¶
graph TD
MS[Master Sheet] -->|Read All Data| PY[Python Script]
PY -->|Replicate| S1[Sibling Sheet 1]
PY -->|Replicate| S2[Sibling Sheet 2]
PY -->|Replicate| S3[Sibling Sheet 3]
PY -->|Replicate| SN[Sibling Sheet N]
style MS fill:#ffd700,stroke:#333,stroke-width:3px
style S1 fill:#add8e6,stroke:#333,stroke-width:2px
style S2 fill:#add8e6,stroke:#333,stroke-width:2px
style S3 fill:#add8e6,stroke:#333,stroke-width:2px
style SN fill:#add8e6,stroke:#333,stroke-width:2px
style PY fill:#3776ab,stroke:#333,stroke-width:2px File Structure¶
master-to-sibling-smartsheet-function/
├── master_to_sibling.py # Main replication script
├── config.py # Configuration management
├── requirements.txt # Python dependencies
├── .env.example # Environment template
└── README.md # Documentation
Environment Variables¶
| Variable | Required | Description | Example |
|---|---|---|---|
SMARTSHEET_ACCESS_TOKEN | Yes | Smartsheet API token | ll... |
MASTER_SHEET_ID | Yes | Master sheet ID | 1234567890123456 |
SIBLING_SHEET_IDS | Yes | Comma-separated sibling IDs | 111,222,333 |
REPLICATED_COLUMN_IDS | No | Specific columns to copy | 1111,2222,3333 |
DRY_RUN | No | Test mode | false |
Setup Instructions¶
1. Clone Repository¶
git clone https://github.com/JFlo21/master-to-sibling-smartsheet-function.git
cd master-to-sibling-smartsheet-function
2. Install Dependencies¶
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
3. Configure Environment¶
Example .env:
SMARTSHEET_ACCESS_TOKEN=your_smartsheet_token
MASTER_SHEET_ID=1234567890123456
SIBLING_SHEET_IDS=2345678901234567,3456789012345678,4567890123456789
# Optional: Specify columns (leave empty for all)
REPLICATED_COLUMN_IDS=
DRY_RUN=false
Usage Examples¶
Basic Replication¶
Dry-Run Mode¶
Specific Sibling Only¶
Verbose Logging¶
Configuration¶
Column Selection¶
Replicate all columns:
Replicate specific columns only:
Match Strategies¶
By Row ID (default):
By Unique Key:
Dependencies¶
Scheduling¶
Cron Job¶
Triggered by Webhook¶
Use Smartsheet webhooks to trigger on changes:
from flask import Flask, request
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook_handler():
data = request.json
if data.get('events'):
# Master sheet changed, trigger sync
os.system('python master_to_sibling.py')
return '', 200
Best Practices¶
Replication Tips
- Set sibling sheets to read-only for users
- Run replication during off-peak hours
- Test with dry-run before production
- Monitor for replication lag
Troubleshooting¶
Data Not Replicating¶
Check master sheet has data:
Permission Errors¶
Ensure API token has Editor access to all sheets (master + siblings).
Partial Failures¶
Script continues on per-sheet failures. Check logs for details.
Related Repositories¶
- Smartsheet Supabase Sync - Sheet to database
- Generate Job Numbers - Auto-numbering