Typed-xlsx

Native Excel table

Native Excel Forecast Table

A real Excel table with structured references, totals rows, auto filters, and table styles while keeping the same schema authoring model.

excel-tableforecastoperations

Dataset

medium

Sheets

1

Artifacts

3

Code + artifacts

File tree

schema.ts

Source file

import { createExcelSchema } from "@chronicstone/typed-xlsx";
import type { ForecastRow } from "./data";

export const nativeForecastSchema = createExcelSchema<ForecastRow>({ mode: "excel-table" })
  .column("repName", {
    header: "Rep",
    accessor: "repName",
    totalsRow: { label: "TOTAL" },
  })
  .column("territory", { header: "Territory", accessor: "territory", minWidth: 14 })
  .column("stage", { header: "Stage", accessor: "stage", minWidth: 12 })
  .column("units", {
    header: "Units",
    accessor: "units",
    totalsRow: { function: "sum" },
    style: { alignment: { horizontal: "right" } },
  })
  .column("revenue", {
    header: "Revenue",
    accessor: "revenue",
    totalsRow: { function: "sum" },
    style: { numFmt: '"$"#,##0', alignment: { horizontal: "right" } },
  })
  .column("avgPrice", {
    header: "Avg Price",
    formula: ({ row, fx }) => fx.round(row.ref("revenue").div(row.ref("units")), 2),
    totalsRow: { label: "-" },
    style: { numFmt: '"$"#,##0.00', alignment: { horizontal: "right" } },
  })
  .column("closeMonth", {
    header: "Close Month",
    accessor: "closeMonth",
    totalsRow: { function: "max" },
  })
  .build();

Workbook preview

Excel output

Excel
Copyright © 2026 Cyprien Thao. Released under the MIT License.