Skip to content

Bug: Pasting from Desktop Excel adds an extra blank row (N rows copied → N+1 rows pasted) #436

@chetanm381

Description

@chetanm381

Summary

When pasting tabular data copied from Desktop Microsoft Excel (Windows) into react-spreadsheet, the library inserts one extra row. If I copy N rows, the component pastes N+1 rows, where the extra row has the first column blank. This does not happen consistently with other sources (e.g., Google Sheets / browser-based copy).

Expected behavior

Copy N rows from Excel → paste should insert exactly N rows, with no additional blank row.

Actual behavior

Copy N rows from Desktop Excel → paste inserts N+1 rows.
The additional row appears at the end (or within the pasted range) and has:

first column empty (blank)

other columns may be empty as well (depends on the paste)

Reproduction steps

Open Microsoft Excel (Desktop, Windows).

Create a small range with N rows and M columns (ex: 2 rows x 6 cols).

Copy the range (Ctrl + C).

In an app using react-spreadsheet, select a cell and paste (Ctrl + V).

Observe that one extra blank row is added.

Notes / Observations

The extra row issue seems specific to Desktop Excel clipboard format.

It looks like Excel may include a trailing newline at the end of the clipboard text (\n), which could be interpreted as an extra empty row when parsing TSV.

In my case this results in unexpected extra rows + wrong row alignment, and breaks downstream logic that relies on exact row counts.

Environment

react-spreadsheet version: [email protected]

React: [email protected]

Browser:
Google Chrome | 143.0.7499.110

OS: Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions