Skip to content

Conversation

@nullnull
Copy link
Contributor

Problem

When copying single empty cell from Google Spreadsheet (or copy some values from Excel), pasting result includes extra empty row.

Cause

Because copied value from Google Spreadsheet's empty cell is "\n".

Solution

I think it's better to delete trailing new line character from pasted text.

src/matrix.ts Outdated
transform: (value: string) => T,
horizontalSeparator = "\t",
verticalSeparator: string | RegExp = /\r\n|\n|\r/
verticalSeparator = /\r\n|\n|\r/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not remove the ability to accept a string here

src/matrix.ts Outdated
verticalSeparator = /\r\n|\n|\r/
): Matrix<T> {
return csv
.replace(new RegExp('(' + verticalSeparator.source + ')$'), '') // delete trailing new line character
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please support getting a string here

@iddan
Copy link
Owner

iddan commented Jul 26, 2021

@nullnull can you please fix my comments so I can merge your PR?

@nullnull
Copy link
Contributor Author

@iddan Sorry for late reply. I've fixed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants