mholt / PapaParse

Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input
http://PapaParse.com
MIT License
12.3k stars 1.14k forks source link

For CSV comma-delimited, when a row ends with an empty cell, papaparse mangles the next row's first cell #1019

Closed ngokevin closed 10 months ago

ngokevin commented 10 months ago
PackTags,Pack,Vocab,PackIcons,PackColor
Food & Drinks,Beverages,Water ; Coffee ; Tea ; Wine ; Beer ; Juice ; Milk ; Soda ; Alcohol ; Drink (Noun),62246 ; 163 ; 16 ; 1817,
Food & Drinks,Dining Out I,Reservation ; Menu ; Appetizer ; Main course ; Side dish ; Dessert ; Beverage ; Check ; Tip ; Drive-through,,
Food & Drinks,Ice cream,Ice cream cone ; Sundae ; Banana split ; Frozen custard ; Tub (Container) ; Vanilla ; Mint ; Cookies and cream ; Chocolate chip ; Cookie dough  ,28990 ; 28990 ; 114102 ; 1676,

Whenever a row ends with a double-comma (empty cell), then the first cell of the next row gets truncated at the beginning by two characters. Food & Drinks becomes od & Drinks

Options:

    csv.parse(file, {
      delimiter: ",",
      dynamicTyping: false,
      header: true,
      skipEmptyLines: true,

Note that the CSV I provided was generated by a previous papaparse.out call

ngokevin commented 10 months ago

Might be an issue with papaparse.out, going to investigate further.