react-datasheet
react-datasheet copied to clipboard
Bug: Copy and paste from MS Excel on a Windows machine pastes an extra empty cell
There's a bug that happens on Windows where copying and pasting multiple cells from MS Excel will paste an extra empty cell. This can unintentionally overwrite existing cells as seen in the screenshot.

This bug is reproducible on the demo as well https://nadbm.github.io/react-datasheet/
This does not happen on Mac.
If anyone comes across this issue, it can be easily fixed by using the parsePaste prop on the <DataSheet> component, and pass it a modified version of the default function with an added .trim() call:
<DataSheet
parsePaste={(pastedString) => {
return pastedString.trim().split(/\r\n|\n|\r/).map(row => row.split('\t'))
}
/>
Fixed the issue for me