Transform Google Sheets into a complete full-stack solution instantly. SheetStack provides a simple way to use Google Sheets as your application backend with features like filtering, sorting, and full-text search.
- 🔄 Complete Backend Solution: Transform any Google Sheet into a full-featured REST API
- 🔍 Advanced Querying:
- Filtering by column values
- Sorting (ascending/descending)
- Pagination support
- Full-text search across all or specific columns
- 🔒 Security:
- API key authentication
- Support for private Google Sheets
- CORS support
- ⚡ Performance:
- Built-in caching
- Efficient data processing
- Clean data handling
- Python 3.8 or higher
- A Google Cloud Project with Google Sheets API enabled
- Google Service Account credentials
- Clone the repository:
git clone https://github.com/scogonw/sheetstack.git
cd sheetstack
- Install dependencies:
pip install -r requirements.txt
-
Set up Google Sheets API:
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Sheets API
- Create a Service Account:
- Go to "IAM & Admin" > "Service Accounts"
- Click "Create Service Account"
- Download the JSON credentials file
- Save the credentials file in your project directory
-
Configure environment (optional):
- Create or edit
.env
file if you need to customize settings:API_KEY=your_api_key_here # Optional: For authenticated APIs GOOGLE_CREDENTIALS_FILE=credentials.json # Optional: If using different filename
- Create or edit
uvicorn main:app --reload
The API will be available at http://localhost:8000
GET /api/v1/sheets/{sheet_id}
Query Parameters:
worksheet
(optional): Sheet name (defaults to first sheet)limit
: Number of records to returnoffset
: Number of records to skipsort
: Sort by field (format: "field:asc" or "field:desc")- Any column name can be used as a filter parameter
GET /api/v1/sheets/{sheet_id}/search
Query Parameters:
worksheet
(optional): Sheet name (defaults to first sheet)q
: Search queryfields
: Specific fields to search in (optional)
GET /health
Include your API key in request headers:
X-API-Key: your_api_key_here
- Get your service account email from credentials.json
- Share your Google Sheet with the service account email
- Use the sheet ID from the URL:
https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit
curl -H "X-API-Key: your_api_key" \
"http://localhost:8000/api/v1/sheets/your_sheet_id"
curl -H "X-API-Key: your_api_key" \
"http://localhost:8000/api/v1/sheets/your_sheet_id?status=active"
curl -H "X-API-Key: your_api_key" \
"http://localhost:8000/api/v1/sheets/your_sheet_id?sort=date:desc"
curl -H "X-API-Key: your_api_key" \
"http://localhost:8000/api/v1/sheets/your_sheet_id/search?q=searchterm"
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Give a ⭐️ if this project helped you!
ScogonW - @scogonw
Project Link: https://github.com/scogonw/sheetstack