AdaptTable for Ant Design

Spreadsheet formulas in Ant Design

A formula column is a column nobody wrote code for: type =ROUND(budget * 0.15, 0) and the table computes it per row, sorts it, filters it and exports it like any other column.

The engine covers arithmetic including POWER and SQRT, comparison, string joins, IF, and the aggregate functions a footer needs. A bad reference reports in the cell that caused it rather than blanking the table, and a circular reference reports #CYCLE! instead of recursing.

Formula columns serialize to the URL with everything else, so a derived column travels in the same link as the filters it sits beside.

The engine returns ordinary column definitions, so a computed column renders through antd's own Table cell — and an error reads as its token text rather than being dressed up as an Alert or a Tag.

The code

import { DataTable } from "@adapttable/antd";
import { buildFormulaColumns } from "@adapttable/react/formula";

const derived = buildFormulaColumns([
  {
    key: "margin",
    header: "Margin",
    formula: "=ROUND(budget * 0.15, 0)",
  },
  {
    key: "tag",
    header: "Tag",
    formula: '=UPPER(team) & " · " & role',
  },
]);

export function People({ rows, columns }) {
  return (
    <DataTable
      data={rows}
      columns={[...columns, ...derived.columns]}
      rowKey={(row) => row.id}
    />
  );
}

Install

pnpm add @adapttable/antd @adapttable/core antd

The same feature in the other kits

More Ant Design features

Reference: formulas. More of this kit: AdaptTable for Ant Design, or the live demo.