ReoGrid ReoGrid Web

Cell Data

ReoGrid Web provides multiple ways to read and write cell values β€” from the high-level CellHandle API to low-level methods optimized for performance.

Live Demo

Accessing via CellHandle

Use worksheet.cell() to obtain a CellHandle and manipulate values.

const ws = grid.worksheet;

// Specify by A1 address
ws.cell('A1').value = 'Hello';

// Specify by row/column index (0-based)
ws.cell(0, 1).value = 'World';

// Read a value
const val = ws.cell('A1').value; // 'Hello'

Chain methods

setValue() is chainable. It can be combined with setStyle() and setFormat().

ws.cell('A1')
  .setValue('Sales')
  .setStyle({ bold: true, backgroundColor: '#dbeafe' })
  .setFormat('#,##0');

Low-level API

For performance-critical code or use inside loops, use the direct methods.

// Set a value
ws.setCellInput(0, 0, 'Hello');

// Read a value
const raw = ws.getCellInput(0, 0);        // Input value (string)
const num = ws.getCellNumericValue(0, 0);  // Get as number
const text = ws.getDisplayText(0, 0);      // Display text (with formatting applied)

// Check if a cell is numeric
const isNum = ws.isNumericCell(0, 0);

Bulk loading with loadCells()

Use loadCells() to set multiple cells at once. Note that loadCells() replaces the entire sheet content β€” all existing cell data is cleared first. For additive bulk loads that keep existing data, use bulkSetCells() instead.

ws.loadCells([
  { row: 0, column: 0, value: 'Name' },
  { row: 0, column: 1, value: 'Age' },
  { row: 1, column: 0, value: 'Alice' },
  { row: 1, column: 1, value: '30' },
]);

Entering formulas

When a value starts with =, it is interpreted as a formula.

ws.cell('C1').value = '=A1+B1';
ws.cell('C2').value = '=SUM(A1:B10)';

See Formula Engine for more details on formulas.


Numbers typed in full-width digits

With a Japanese IME on, a number comes out in full-width digits. Since v1.7.0 a typed entry that is a number once its full-width digits (and οΌ‹ - .) are folded is stored half-width, as in Excel β€” β€œοΌ‘οΌ’οΌβ€ goes in as 120, β€œοΌοΌ‘οΌ’οΌŽοΌ•β€ as -12.5 β€” so formulas and number formats treat it as a number. Text that merely contains a full-width digit, such as β€œοΌ“ιšŽβ€, is kept as typed.

This applies to what users type into a cell. Values set from code (setCellInput, cell.value) are stored as given. In a form, such a number also moves on to the next field with a single Enter.


Performance tips

When updating a large number of cells, suspending rendering improves performance.

ws.suspendRender();
try {
  for (let r = 0; r < 1000; r++) {
    ws.setCellInput(r, 0, `Row ${r}`);
    ws.setCellInput(r, 1, String(r * 100));
  }
} finally {
  ws.resumeRender(); // Resume rendering and redraw all at once
}

suspendRender() prevents the canvas from repainting after every change. Call resumeRender() when you are done to flush all updates in a single repaint.

Since v1.7.2 the calls nest: each suspendRender() needs its own resumeRender(), and rendering resumes β€” redrawing once β€” at the outermost one. A batch inside another batch (for example an onUndoRedoChange listener that batches its own work) therefore no longer loses the redraw the outer one requested. An unmatched resumeRender() is ignored.

Stay Updated

Be first to know β€” get updates as they ship

Get notified of new releases, features, and announcements.
No spam β€” just updates that matter.