π― Introduction
We currently have candidate login and signup data, but we are not fully prepared to build a dedicated dashboard product to support a client. Developing a new dashboard requires coding effort, particularly integrating UI-based libraries that we are not equipped to handle. Additionally, most existing dashboard services come with additional costs, which we want to avoid for now. βπ°
As an alternative, using Google Sheets for a semi-manual dashboard is a great idea, especially since Google offers powerful Apps Script automation. This allows us to keep our data up-to-date without maintaining a full-fledged web-based dashboard. β π
π Solution: Using Google Sheets as a Dashboard
Google provides the necessary infrastructure for handling live data updates within Google Sheets using Apps Script. By leveraging this, we can:
- π‘ Fetch candidate data from our API.
- π Store and visualize data in Google Sheets.
- π Automate updates using triggers to refresh data periodically.
πΉ Steps to Implement
- π Get Google File and Sheet ID
Each Google Sheet has a unique file ID that can be accessed from the URL. Individual sheets within the file have unique sheet IDs.
π How to Get Google File and Sheet ID
From a Google Sheets URL:
https://docs.google.com/spreadsheets/d/FILE_ID/edit#gid=SHEET_ID
π File ID: Found between /d/ and /edit
π Sheet ID: Found after gid= in the URL
- π₯οΈ Write an Apps Script to fetch and store API data in Google Sheets.
Here is a basic script to fetch data from an API and update Google Sheets:
function fetchAPIData() {
var url = "https://api.example.com/data";
var response = UrlFetchApp.fetch(url);
var json = JSON.parse(response.getContentText());
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.clear();
var headers = json.headers;
sheet.appendRow(headers);
json.rows.forEach(function(row) {
sheet.appendRow(row);
});
}
β° Set a Trigger to refresh the data at regular intervals.
π Secure the API using an App Key for controlled access.
β οΈ Issues Encountered
- π« ngrok is blocked β We were unable to use ngrok for API tunneling.
- β localhost did not work β Direct local API connections failed.
- β Hosting with our existing domain worked β Using an AppRunner custom domain (pointed via GoDaddy) successfully allowed API access.
ποΈ API Structure
A simple API should return structured JSON data.
The API should parse CSV headers and rows dynamically.
Example JSON structure:
{
"headers": ["Name", "Email", "Signup Date"],
"rows": [
["John Doe", "john@example.com", "2024-02-01"],
["Jane Smith", "jane@example.com", "2024-02-02"]
]
}
π Architecture Flow
- β³ Trigger: Google Apps Script trigger initiates the data refresh.
- π API Call: Apps Script fetches data from our API.
- π Security: API is secured using an App Key.
- π₯ Google Sheets Update: Data is parsed and inserted into Google Sheets.
ποΈ Flow Diagram:
β³ Trigger (Google Apps Script) β π API Request β π Secure via App Key β π₯ Insert Data into Google Sheets
ποΈ Database Architecture Considerations
To optimize performance, we use Materialized Views in our database. This helps:
- β‘ Reduce direct DB load.
- π Speed up query execution.
- π Improve dashboard response times
π― Conclusion
Using Google Sheets as a semi-automated dashboard is an effective and low-cost solution for handling candidate data. With minimal coding effort, we can keep data fresh and provide a functional dashboard without investing in a full-fledged UI-based system. This approach ensures scalability while keeping infrastructure costs low. β ππ‘
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.