I am currently dealing with the problem of copying multiple rows of one column from Excel (on macOS) to the browser. I get eventand access the copied content as follows:event.clipboardData.getData('text/plain');
After I got the content, I want to break them down with the following types:
const separators = [',', ';', '\\(', '\\)', '\\*', '/', ':', '\\?', '\n', '\t'];
return data.split(new RegExp(separators.join('|'), 'g')).map(d => d.trim());
This works great in Firefox, but not in the latest Chrome and Safari browsers. I thought you would match newlines with \nor \t. My goal is to get an array of values per line. I guess this has something to do with Excel's special endings, because when using Numbers from Apple everything works fine.
Any help is really appreciated. Thanks in advance!
source
share