SheetXL - v1.0.2
    Preparing search index...

    Function useTable

    • Returns the table named name and re-renders when it changes: rows added or removed, its cells edited, or its settings changed.

      Parameters

      • target: CellRangeTarget | null | undefined

        The workbook or sheet to find the table in, or null while there is none. A workbook looks in each of its sheets.

      • name: string

        The table's name.

      • Optionaloptions: CellRangeHookOptions

        Listener options for its cells, and an optional onChange that receives each change event in them.

      Returns ITable | null

      The table, or null while target is null or has no table of that name.

      The returned table is the same object across renders; read from it during render, and change it through its own methods, such as ITable.addRow and ITable.deleteRowsAt.

      const items = useTable(workbook, 'Items');
      const rows = items?.getDataRange().getValues() ?? [];
      return <button onClick={() => items?.addRow()}>Add</button>;