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:
- Paste: select
A1:C3, copy it (Ctrl/Cmd+C), clickD5and paste. It runs past the last row and column. - Clipboard: copy the text below, click
A5and paste — a 4-row block into a 6-row sheet. - Autofill: select
E1:E3and 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.
Implementation Guide
Section titled “Implementation Guide”Enable it
Section titled “Enable it”<GridSheet initialCells={initialCells} options={{ autoExpand: 'both', limits: { maxRows: 200, maxCols: 26 }, }}/>| Value | Overflowing 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. |
What it covers
Section titled “What it covers”- 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()andsheet.writeRawCellMatrix()follow the same setting.
Behavior details
Section titled “Behavior details”- 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.