Cells and formulas

Write values and formulas, apply range formatting, and export XLSX bytes.

Values and formulas

Inline grid edits are literal values. SpreadsheetFormulaBar interprets a leading equals sign as a formula. The headless API takes formula source without that leading sign.

TypeScript
import { openSpreadsheetArtifact } from '@tumblerjs/sheets';

let artifact = openSpreadsheetArtifact(bytes);
artifact = artifact
  .editCell('B2', 120)
  .editCell('B3', 80)
  .editFormula('B4', 'SUM(B2:B3)');

artifact.worksheet.cell('B4')?.formula; // SUM(B2:B3)
artifact.calculation.displayText('B4'); // 200

Formatting and export

TypeScript
artifact = artifact.applyFormatting('A1:D1', {
  text: { bold: { set: true } },
  block: { horizontalAlignment: { set: 'center' } }
});

const output = artifact.bytes();

Ordinary formulas are editable. Shared, array, data-table, dynamic-array, and external-workbook formula structures are not currently editable.

Next Spreadsheet compatibility