Handsontable has difficulties with large data pastes

Tags: #<Tag:0x00007f2491ed48f8>

When I paste 50k rows of data on handsontable it freezes, if anyone else is going through this problem I made this function which I call inside ‘onBeforePaste’ which resolves it

export const largePaste = (tableRef: MutableRefObject, changes, coords) => {
if (tableRef.current) {
const hot = tableRef.current.__hotInstance as Handsontable;
if (!coords) return;

const rowCount = hot.countRows() - 1;
const difference = rowCount - coords[0].startRow;
hot.batch(() => {
  if (changes.length - difference > 0)
    hot.alter('insert_row', coords[0].startRow + difference + 1, changes.length - difference);
  hot.scrollViewportTo(coords[0].startRow - 1 ?? 0, 0);


If there is a better way of fixing it, I would love to hear. but this batch works great.

Hi @ronaldo.jonson

Thank you for your message. It is a long known problem with handling larger amount of data. This is why we introduced batch operations, for handling such situations better. I will leave this topic open if anyone would come up with other ideas regarding this issue.

1 Like