Excel KPI to README Badges File
Weekly schedule reads KPIs from Excel Online and regenerates a metrics.md file via Create Or Update A Repository File so README badges always reflect current numbers.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
Organizations often want README badges to reflect *real* operational numbers — not static shields.io text. This flow pulls KPI rows from a curated Excel Online workbook (SharePoint-hosted) every Monday morning, renders them as a Markdown table with a shields.io badge strip, and commits the generated docs/metrics.md back to a GitHub repository using the GitHub REST API via HTTP built-in. README files can then reference the live badges directly.
This pattern is broadly reusable: swap the Excel table for any structured data source and you have a generic "regenerate markdown file on schedule and commit to repo" engine.
Use Case
Engineering and product teams often want a single source of truth for operational KPIs — build status, test coverage, open-issue counts, customer-impact incidents — visible right at the top of the repo's README. Maintaining those numbers by hand fails immediately. This flow keeps a generated metrics file in sync automatically using whatever the team already tracks in Excel.
The flow is ideal for teams that:
- Teams that maintain an operational KPI workbook in Excel Online.
- Repositories that want live README badges instead of static text.
- Generic 'regenerate markdown and commit to repo' on a schedule.
- Don't want to set up GitHub Actions just to publish numbers.
Flow Architecture
Weekly Monday 09:00 EST
RecurrenceFires once per week at the start of Monday.
Init 9 runtime variables
InitializeVariableHydrates env-var-backed variables at the top of the flow so downstream actions reference variables() instead of re-evaluating parameters().
Get_KPI_Rows
Excel Online GetItemsReads all rows from the configured Excel table on the SharePoint-hosted workbook.
Build_Metric_Rows
SelectProjects each row into a single Markdown table row using concat() + coalesce() for null-safe cells.
Build_Markdown_Content
ComposeAssembles title, timestamp, badge strip, KPI table, and footer; nested replace() unwraps the Select output to newline-joined rows.
Get_Current_Badge_File
HTTP GETGET /repos/{owner}/{repo}/contents/{path}?ref={branch} to fetch the current file SHA if it exists. 200 = update path; 404 = create path.
Check_If_Badge_File_Exists
If conditionBranches on outputs('Get_Current_Badge_File')?['statusCode'] equals 200.
- Update_Existing_Badge_File — HTTP PUT with base64-encoded Markdown content + the existing SHA (required by GitHub for updates).
Update_New_Badge_File: HTTP PUT with base64-encoded Markdown content only — GitHub creates the new file.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | Root SharePoint URL hosting the Excel KPI workbook. |
| flowlibs_ExcelKpiFilePath | String | /Shared Documents/FlowLibs - KPI Metrics.xlsx | Server-relative path to the workbook. |
| flowlibs_ExcelKpiTableName | String | KpiMetrics | Named Excel Table inside the workbook. |
| flowlibs_GitHubOwner | String | your-org | GitHub org or user. |
| flowlibs_GitHubRepository | String | flowlibs-demo | Repository name. |
| flowlibs_GitHubBadgeFilePath | String | docs/metrics.md | Repo-relative path for the generated markdown. |
| flowlibs_GitHubCommitBranch | String | main | Target branch for commits. |
| flowlibs_GitHubCommitMessage | String | chore: regenerate README badge file [automated] | Commit message template. |
| flowlibs_GitHubApiToken | String | — | GitHub PAT with `Contents: Write` scope — populated per tenant. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Excel Online | shared_excelonlinebusiness | GetItems (reads the named KPI table) |
| HTTP | shared_http | GET (fetch current file SHA) PUT (create/update via GitHub Contents API) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Populate the GitHub PAT
- Set flowlibs_GitHubApiToken to a fine-grained PAT with Contents: Read and Write on the target repo.
- Point to your workbook
- Update flowlibs_SharePointSiteURL, flowlibs_ExcelKpiFilePath, flowlibs_ExcelKpiTableName. The Excel Table must have columns Metric/Value/Target/Owner.
- Point to your repo
- Update GitHub owner/repo/branch/path env vars.
- Adjust the schedule
- Edit the recurrence trigger's timeZone / weekDays / frequency to match the target cadence.
- Enable the flow
- Flow ships in state: Stopped. Turn it on from the solution page after populating secrets.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Build_Metric_Rows select
Builds one Markdown table row per KPI.
EXPR.02Strip Select JSON wrapper
Unwraps the Select output to newline-joined rows.
EXPR.03GitHub PUT body — update path
GitHub's contents API requires the current file SHA when updating.
EXPR.04GitHub HTTP headers
User-Agent is required by the GitHub API.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.