Multi-Excel Data Dashboard with Analytics

By Sapan Sora · Published July 25, 2026

Build a self-contained HTML dashboard embedding SheetJS and Chart.js to visualize and analyze Excel data with interactive charts.

2 cells1 experiment7 views0 forks

Inside this notebook

# Assemble the single self-contained dashboard: inline SheetJS + Chart.js into the HTML template.
from pathlib import Path

vendor = Path("/home/user/vendor")
template = Path("/home/user/app_template.html").read_text(encoding="utf-8")

xlsx_js = (vendor / "xlsx.full.min.js").read_text(encoding="utf-8")
chart_js = (vendor / "chart.umd.min.js").read_text(encoding="utf-8")

# Sanity: markers must each appear exactly once and NOT inside the library code
assert template.count("/*__XLSX__*/") == 1, "XLSX marker missing/duplicated"
assert template.count("/*__CHART__*/") == 1, "CHART marker missing/duplicated"
assert "/*__XLSX__*/" not in xlsx_js and "/*__CHART__*/" not in chart_js, "marker collision in vendor code"

html = template.replace("/*__XLSX__*/", xlsx_js).replace("/*__CHART__*/", chart_js)

# Confirm both libs are now embedded and no placeholder markers remain
assert "/*__XLSX__*/" not in html and "/*__CHART__*/" not in html
…
✅ Built excel_dashboard.html
   Final size : 1,111.6 KB (1,138,263 bytes)
   SheetJS    : 639,123 chars inlined
   Chart.js   : 205,399 chars inlined
   External refs (http/cdn): 82
   <script> tags: 3  (expect 3: xlsx, chart, app)
# Final verification: file completeness + JS bracket balance of the app script.
import re, os

path = "/home/user/excel_dashboard.html"
html = open(path, encoding="utf-8").read()
print("file bytes on disk :", f"{os.path.getsize(path):,}")
print("ends with </html>  :", html.rstrip().endswith("</html>"))

scripts = re.findall(r"<script>(.*?)</script>", html, flags=re.S)
app = scripts[-1]
print("script blocks      :", len(scripts), "| app script chars:", f"{len(app):,}")

def strip_js(code):
    """Remove comments/strings/templates so bracket counts aren't fooled."""
    out, i, n, mode = [], 0, len(code), None
    while i < n:
        c = code[i]; nxt = code[i+1] if i+1 < n else ""
        if mode is None:
…
file bytes on disk : 1,138,263
ends with </html>  : True
script blocks      : 3 | app script chars: 27,629
  balance {}: 274 / 274 -> OK
  balance (): 795 / 795 -> OK
  balance []: 121 / 121 -> OK
core flow keywords : all present ✓

✅ VERIFICATION PASSED
Multi-Excel Data Dashboard with Analytics | Clusy