Skip to content

Growing the Sheet on Paste & Autofill

By default, a paste or an autofill that runs past the sheet’s last row or column is clipped — the overflow is dropped. With the autoExpand option the sheet grows instead: the missing rows and/or columns are appended, and the growth undoes together with the write.

Switch the mode and try the steps below the selector.

autoExpand:
  1. Paste: select A1:C3, copy it (Ctrl/Cmd+C), click D5 and paste. It runs past the last row and column.
  2. Clipboard: copy the text below, click A5 and paste — a 4-row block into a 6-row sheet.
  3. Autofill: select E1:E3 and drag its fill handle (the small square) below the sheet and hold. Provisional rows appear — faster the further you pull — and are added when you release.

Undo (Ctrl/Cmd+Z) removes the added rows/columns together with the pasted or filled values.

📄 View Source Code
<GridSheet
initialCells={initialCells}
options={{
autoExpand: 'both',
limits: { maxRows: 200, maxCols: 26 },
}}
/>
ValueOverflowing paste / autofill
'none' (default)Clipped at the last row/column.
'vertical'Appends rows; columns are still clipped.
'horizontal'Appends columns; rows are still clipped.
'both'Appends rows and columns as needed.
  • Paste — copied cells, cut cells, and text/HTML from the clipboard.
  • Autofill — drag the fill handle past the last row/column and hold: provisional rows/columns appear one at a time, faster the further you pull. They are display-only until you release; then the sheet grows to the row/column you reached and the fill is written. Rows you pulled back from are simply discarded.
  • Programmatic writes through sheet.copy(), sheet.move() and sheet.writeRawCellMatrix() follow the same setting.
  • One undo step — the appended rows/columns and the write are recorded together, so a single undo reverts both.
  • Layout — new rows/columns copy the style, size and policy of the current last row/column, just like inserting rows below the last one.
  • Limits — growth stops at limits.maxRows / limits.maxCols; anything beyond is still clipped.
  • Visibility — the sheet’s viewport keeps its size, so after a paste or fill that grew it, the grid scrolls the written range’s far corner into view.