mholt/PapaParse

Missing quotes when parsing.

Open

#712 建立於 2019年10月2日

在 GitHub 查看
 (4 留言) (0 反應) (0 負責人)JavaScript (11,877 star) (1,157 fork)batch import
help wanted

描述

I've got the following two pieces of data in Excel:

Hi - need the forecasting documents for ColorTokens- they do not have a master payer, but want to do an EDP. Not sure if they need the master payer to do the EPD. Here are their IDs: 096742272934 070181106296 244882251506 602341081844 664991688287 681262709514 816618564346 822256776645 Deferred to CE Cost Optimization

and

"This is" is not a movie"

When you copy this data from Excel, it wraps the first big block in quotes and this is the string data I see:

"Hi - need the forecasting documents for ColorTokens- they do not have a master payer, but want to do an EDP. Not sure if they need the master payer to do the EPD.

Here are their IDs: 096742272934 070181106296 244882251506 602341081844 664991688287 681262709514 816618564346 822256776645

Deferred to CE Cost Optimization" "This is" is not a movie"

JSON.stringify shows this: ""Hi - need the forecasting documents for ColorTokens- they do not have a master payer, but want to do an EDP. Not sure if they need the master payer to do the EPD. \n\nHere are their IDs: \n096742272934\n070181106296\n244882251506\n602341081844\n664991688287\n681262709514\n816618564346\n822256776645\n\nDeferred to CE Cost Optimization"\t"This is" is not a movie""

The issue is when I take this data and run it through Papaparse like such: Papa.parse(data, { delimiter: "\t" }), the surrounding quotes are dropped.

This makes sense for the larger block of text - Excel wrapped the larger block in quotes for the CSV to state that it is one cell's contents.

For the smaller text though, we now see This is" is not a movie, which is incorrect. Is there a config to resolve this?

When I try escaping the first and last quote in my strings, then the problem is solved for the smaller text and I see the quotes, but then the larger block of text begins with " and ends with " in the output as well which isn't right.

貢獻者指南