SheetsDBProxy

A secure HTTP backend API that acts as a proxy between Google Sheets and a PostgreSQL database. It validates and executes read-only SQL queries, returning data ready for your spreadsheets.

GET/api/health
Check if the API is running and available.

Example cURL

curl "/api/health"

Success Response (200)

{
  "status": "ok",
  "timestamp": "..."
}
POST/api/run-sql
Executes a secure, read-only SQL query.

Headers

X-API-Key: Your secret API key.

Body

{
  "sql": "SELECT id, name FROM users LIMIT 5"
}

Example cURL

curl -X POST "/api/run-sql" \
-H "Content-Type: application/json" \
-H "X-API-Key: your_secret_api_key" \
-d '{"sql": "SELECT 1 AS result"}'
Configuration
The API is configured via environment variables.

For local development, create a .env.local file in the project root. For production, set these variables in your hosting provider's settings.