π GitHub Repository Comparison with Async Formulas
This demo showcases async formula functions in GridSheet by fetching live repository data from the GitHub API.
It compares popular frontend frameworks and runtimes β React, Vue, and Svelte β displaying stars, forks, open issues, language, license, and last updated date side by side.
Each cell containing a GH_REPO formula fetches data asynchronously and shows a loading animation while the request is in flight. The bottom row uses SUM to total stars, forks, and issues β it stays pending until all async cells resolve.
π‘ Data is fetched live from the GitHub API with 1-minute caching. Each cell with a GH_REPO formula shows a loading animation while the request is in flight. Try editing a repository name in column A to fetch data for a different repo. The bottom row uses SUM to total stars, forks, and issues β it stays pending until all async cells resolve.
Implementation Guide
π View Source Codeπ Custom Async Formula: GH_REPO
The GH_REPO(repo, field) formula is implemented by extending BaseFunction with an async main() method. When the formula is evaluated, GridSheet automatically detects the async return and displays a pending animation while the network request completes.
π‘ GitHub API Integration
The function calls GitHub's public REST API (api.github.com/repos/...) to retrieve repository metadata. No authentication is required for public repos, and the API supports CORS out of the box.
π Chained Dependencies
The summary row uses SUM(B2:B9) to total all stars β since each source cell is async, the SUM automatically propagates the pending state until all upstream cells resolve.
π¨ Custom Renderers
- Repository renderer: Clickable links to GitHub
- Number renderer: Locale-aware formatting with thousands separators
- Language renderer: Color-coded dots matching GitHub's language colors
- Header renderer: Dark themed header row
β Try It Out
- Edit a repository name in column A to fetch data for any public repo
- Watch the loading animation cascade through dependent cells
- The total row stays pending until all repos are loaded