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.
Overview
Pulls KPI rows from a curated Excel Online workbook (SharePoint-hosted) every Monday morning, renders them as a Markdown table with 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  or reference live badges directly.
Broadly reusable — swap the Excel table for any structured data source for a generic regenerate-markdown-on-schedule-and-commit engine.
**State:** Off (Draft)
Use Case
Organizations want README badges to reflect *real* operational numbers — not static shields.io text. This flow pulls KPI rows from Excel Online weekly, renders Markdown badges, and commits to a GitHub repo.
**Key Benefits:** real KPIs in README; reusable pattern for any structured-data → markdown commit; HTTP built-in keeps it on standard licensing (no premium GitHub connector for file writes).
Flow Architecture
Trigger: **Recurrence (Weekly Monday 9:00 AM EST)**.
1. Init 9 variables from env vars
2. Get_KPI_Rows (Excel Online GetItems)
3. Build_Metric_Rows (Select projects each row to Markdown table row)
4. Build_Markdown_Content (Compose) — title, timestamp, badge strip, KPI table, footer
5. Get_Current_Badge_File (HTTP GET /repos/{owner}/{repo}/contents/{path}) — returns SHA if exists
6. Check_If_Badge_File_Exists (If on statusCode == 200, runAfter Succeeded/Failed)
- True: Update_Existing_Badge_File (HTTP PUT with base64 + SHA)
- False: Create_New_Badge_File (HTTP PUT with base64 only)Environment Variables
| Variable | Schema Name | Type | Default | Purpose |
|---|---|---|---|---|
| SharePoint Site URL | flowlibs_SharePointSiteURL | String | https://aronhomelab.sharepoint.com | Root SharePoint URL hosting the Excel KPI workbook |
| Excel KPI File Path | flowlibs_ExcelKpiFilePath | String | /Shared Documents/FlowLibs - KPI Metrics.xlsx | Server-relative path to the workbook |
| Excel KPI Table Name | flowlibs_ExcelKpiTableName | String | KpiMetrics | Named Excel Table inside the workbook |
| GitHub Owner | flowlibs_GitHubOwner | String | aronhomelab | GitHub org or user |
| GitHub Repository | flowlibs_GitHubRepository | String | flowlibs-demo | Repository name |
| GitHub Badge File Path | flowlibs_GitHubBadgeFilePath | String | docs/metrics.md | Repo-relative path for generated markdown |
| GitHub Commit Branch | flowlibs_GitHubCommitBranch | String | main | Target branch for commits |
| GitHub Commit Message | flowlibs_GitHubCommitMessage | String | chore: regenerate README badge file [automated] | Commit message template |
| GitHub API Token | flowlibs_GitHubApiToken | Secret | (none) | GitHub PAT with Contents: Write scope |
Connectors & Connections
| Connector | API Name | Connection Format | Usage |
|---|---|---|---|
| Excel Online (Business) | shared_excelonlinebusiness | new_sharedexcelonlinebusiness_fefa5 | GetItems — read KPI rows |
| HTTP (built-in) | - | - | GitHub REST API — GET + PUT /repos/.../contents/{path} |
Customization Guide
1. Set flowlibs_GitHubApiToken to a fine-grained PAT with Contents: Read+Write scope.
2. Point env vars to your workbook (Excel Table must have Metric, Value, Target, Owner columns case-sensitive) and your repo.
3. Adjust schedule recurrence as needed.
4. Enable the flow.
Key Expressions
- @concat('| ', coalesce(item()?['Metric'], ''), ' | ', coalesce(item()?['Value'], ''), ' | ', coalesce(item()?['Target'], ''), ' | ', coalesce(item()?['Owner'], ''), ' |') — Build_Metric_Rows select
- replace(replace(replace(string(body('Build_Metric_Rows')), '"},{"html":"', '\n'), '[{"html":"', ''), '"}]', '') — strip Select JSON wrapper
- GitHub PUT body: {"message":..., "content":"@{base64(outputs('Build_Markdown_Content'))}", "branch":..., "sha":"@{coalesce(body('Get_Current_Badge_File')?['sha'], '')}"}