Getting started overview
Sheetsu enables developers to convert Google Sheets into RESTful API endpoints, allowing for programmatic access to spreadsheet data. This guide details the process of obtaining API credentials and making an initial API call. The typical workflow involves:
- Creating a Sheetsu account.
- Connecting a Google Sheet to the Sheetsu platform.
- Generating an API URL for the connected sheet.
- Constructing and executing an HTTP request to interact with the sheet data.
Sheetsu supports standard CRUD (Create, Read, Update, Delete) operations, which are fundamental for managing data programmatically. For example, a GET request retrieves data, while a POST request adds new rows to a Google Sheet. The platform does not provide official SDKs, meaning developers construct HTTP requests directly using standard web technologies or HTTP client libraries in their chosen programming language.
Quick reference table
| Step | What to do | Where |
|---|---|---|
| 1. Sign Up | Register for a Sheetsu account. | Sheetsu homepage |
| 2. Create API | Connect a Google Sheet and generate an API URL. | Sheetsu Dashboard > Create API |
| 3. Get Credentials | Note your API URL and API Key (if required for private sheets). | Sheetsu Dashboard > Your API |
| 4. First Request | Send a GET request to your API URL. |
Code editor or API client (e.g., cURL) |
Create an account and get keys
To begin using Sheetsu, you must create an account and connect a Google Sheet. This process establishes the foundation for your API interactions.
Account creation
- Navigate to the Sheetsu website.
- Click on the "Sign Up" or "Get Started Free" button.
- Register using your email address or a Google account. Sheetsu offers a free tier that includes 50 requests per month, which is sufficient for initial testing and development.
- After registration, you will be redirected to the Sheetsu dashboard.
Connecting a Google Sheet
Within the Sheetsu dashboard, the next step is to link a Google Sheet that will serve as your data source.
- Ensure your Google Sheet is publicly accessible or shared with the Sheetsu service account if it contains sensitive data. For a public sheet, the sharing setting should be "Anyone with the link can view." For more controlled access, refer to the Sheetsu authorization documentation.
- From your Sheetsu dashboard, click "Create new API".
- Paste the full URL of your Google Sheet into the provided field.
- Sheetsu will process the sheet and generate a unique API endpoint URL. This URL is your primary access point for all future API requests to that specific Google Sheet.
API key generation and access
For sheets that are not publicly accessible or when performing write operations, Sheetsu requires an API key for authentication. This key ensures that only authorized applications can modify your data.
- After creating your API endpoint, navigate to its details page within the Sheetsu dashboard.
- Locate the "API Key" section. If an API key is not displayed, you may need to enable private access settings for your sheet.
- Copy the displayed API key. This key will need to be included in the headers of your HTTP requests for authenticated calls. The HTTP Authorization header is a standard method for transmitting credentials.
Your first request
After setting up your Sheetsu API, you can make your first API call to retrieve data from your Google Sheet. This example uses a GET request to fetch all rows from the sheet.
Prerequisites
- Your Sheetsu API endpoint URL.
- (Optional, but recommended for private sheets) Your Sheetsu API Key.
- A Google Sheet with some sample data. For instance, a sheet with columns like
Name,Email, andDate, and a few rows of data.
Making a GET request to retrieve data
The simplest way to test your API is by making a GET request to your Sheetsu API URL. This will return all data from the first visible tab of your linked Google Sheet as a JSON array.
Using cURL (command line)
cURL is a command-line tool for making HTTP requests and is often pre-installed on Unix-like systems. It's useful for quick tests.
curl -X GET "YOUR_SHEETSU_API_URL"
Replace YOUR_SHEETSU_API_URL with the actual API endpoint URL provided by Sheetsu in your dashboard.
Using JavaScript (Fetch API)
For web applications, the Fetch API is a common way to make HTTP requests from the browser.
fetch('YOUR_SHEETSU_API_URL')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error fetching data:', error));
Again, replace YOUR_SHEETSU_API_URL with your specific Sheetsu endpoint.
Using Python (Requests library)
The Requests library is a popular HTTP client for Python.
import requests
api_url = "YOUR_SHEETSU_API_URL"
response = requests.get(api_url)
if response.status_code == 200:
data = response.json()
print(data)
else:
print(f"Error: {response.status_code} - {response.text}")
Ensure you have the Requests library installed (pip install requests). Substitute YOUR_SHEETSU_API_URL with your Sheetsu endpoint.
Expected response
A successful GET request will return a JSON array, where each object in the array represents a row from your Google Sheet, and the keys correspond to your sheet's header row values.
[
{
"Name": "John Doe",
"Email": "[email protected]",
"Date": "2023-01-15"
},
{
"Name": "Jane Smith",
"Email": "[email protected]",
"Date": "2023-02-20"
}
]
Common next steps
Once you have successfully made your first GET request, you can explore other functionalities provided by Sheetsu and integrate them into your applications.
- Write Data (
POSTrequests): To add new rows to your Google Sheet, send aPOSTrequest to your API URL with a JSON body containing the data for the new row. For detailed examples, consult the Sheetsu POST request documentation. - Update Data (
PUT/PATCHrequests): Modify existing rows usingPUTorPATCHrequests. These typically require specifying a row identifier or a query parameter to target the specific data to be updated. The Sheetsu PUT/PATCH documentation provides usage instructions. - Delete Data (
DELETErequests): Remove rows from your Google Sheet with aDELETErequest, often targeting rows based on specific criteria. Refer to the Sheetsu DELETE request guide for specifics. - Query Parameters: Sheetsu supports various query parameters to filter, sort, and limit the data returned by
GETrequests. This allows for more precise data retrieval without fetching the entire sheet. For example,?limit=10or?where={'Name':'John Doe'}. The Sheetsu query parameters documentation details available options. - Error Handling: Implement robust error handling in your application to gracefully manage scenarios where API requests fail, such as network issues, invalid API keys, or malformed requests. Understanding HTTP status codes is crucial for this.
- Webhooks: Configure webhooks to trigger actions in other services when your Google Sheet data changes. This enables real-time integrations and automations. Information on setting up webhooks can be found in the Sheetsu webhooks documentation.
- Security Best Practices: For production applications, ensure your API key is stored securely and transmitted over HTTPS. Avoid hardcoding credentials directly into client-side code.
Troubleshooting the first call
Encountering issues during your first API call is common. Here are some troubleshooting steps:
- Check API URL: Double-check that the API URL you are using exactly matches the one provided in your Sheetsu dashboard. Any typos or missing characters will result in a 404 Not Found error.
- Google Sheet Sharing Settings: Ensure your Google Sheet is correctly shared. If your sheet is private, you must either make it publicly viewable (not recommended for sensitive data) or ensure you are including your API key in the request headers for authentication. The Google Docs sharing settings guide can assist with verification.
- API Key in Headers: If your sheet is not public, verify that the API key is correctly included in the
Authorizationheader of your request (e.g.,Authorization: Bearer YOUR_API_KEYorX-Sheetsu-API-Key: YOUR_API_KEY, depending on Sheetsu's current specification as per Sheetsu authorization docs). - Network Connectivity: Confirm that your local environment has active internet connectivity and that no firewall or proxy is blocking outgoing HTTP requests to Sheetsu's domain.
- HTTP Method: Ensure you are using the correct HTTP method (e.g.,
GETfor retrieval,POSTfor creation). Using an incorrect method will often result in a 405 Method Not Allowed error. - JSON Body Format (for POST/PUT/PATCH): If you are making a request that includes a JSON body (like
POST), ensure the JSON is valid and correctly formatted. Malformed JSON can lead to 400 Bad Request errors. Online JSON validators can help confirm correctness. - Sheetsu Dashboard Status: Check your Sheetsu dashboard for any error messages or status indicators related to your API endpoint. Sheetsu may provide specific feedback on issues.
- Browser Developer Tools/API Client Logs: Use your browser's developer tools (Network tab) or your API client's logging features to inspect the exact request being sent and the response received, including HTTP status codes and response bodies. This can provide clues about where the request is failing.