We need to offer to our customers a way of copy pasting an excel to a table in a web application. We split rows with line breaks, and columns with tabulation.
The problems is that in a single cell you can have line break so the split(\n)
will simply understand that there is a new row.
const rows = event.target.value.split('\n');
for (let row of rows) {
const values = row.split('\t');
}
With the code above, when there are no line break in cells we can get a nice table of the copy paste, but as soon as there are linebreaks in cells, everything is move to one row and break everything.
How can I differentiate line breaks for delimiting rows and line breaks in cells ?