CSV with commas in contents (column names)

Date,Algoma_Public_Health_Unit,Brant_County_Health_Unit,Chatham-Kent_Health_Unit,Durham_Region_Health_Department,Eastern_Ontario_Health_Unit,Grey_Bruce_Health_Unit,Haldimand-Norfolk_Health_Unit,"Haliburton,_Kawartha,_Pine_Ridge_District_Health_Unit",Halton_Region_Health_Department,Hamilton_Public_Health_Services,Hastings_and_Prince_Edward_Counties_Health_Unit,Huron_Perth_District_Health_Unit,"Kingston,_Frontenac_and_Lennox_&_Addington_Public_Health",Lambton_Public_Health,"Leeds,_Grenville_and_Lanark_District_Health_Unit",Middlesex-London_Health_Unit,Niagara_Region_Public_Health_Department,North_Bay_Parry_Sound_District_Health_Unit,Northwestern_Health_Unit,Ottawa_Public_Health,Peel_Public_Health,Peterborough_Public_Health,Porcupine_Health_Unit,"Region_of_Waterloo,_Public_Health",Renfrew_County_and_District_Health_Unit,Simcoe_Muskoka_District_Health_Unit,Southwestern_Public_Health,Sudbury_&_District_Health_Unit,Thunder_Bay_District_Health_Unit,Timiskaming_Health_Unit,Toronto_Public_Health,Wellington-Dufferin-Guelph_Public_Health,Windsor-Essex_County_Health_Unit,York_Region_Public_Health_Services,Total
2020-03-24,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0
2020-03-25,0,1,0,3,0,1,0,0,1,3,0,0,3,0,0,0,1,0,0,3,3,0,0,2,0,0,0,1,0,0,17,1,1,5,46
2020-03-26,0,0,0,1,0,0,0,1,4,4,2,0,5,0,0,2,1,0,0,0,13,2,3,0,0,1,0,0,0,1,21,1,2,5,69
2020-03-27,0,0,0,5,0,1,0,14,1,1,0,0,0,5,0,4,2,1,1,5,15,3,0,3,0,4,2,1,0,0,22,0,0,34,124

I am trying to parse this using the csv node, but looks like column marked "Haliburton,_Kawartha,_Pine_Ridge_District_Health_Unit" isn't being marked as column instead is split in to 3 columns and hence the data is not really correct.

{
  "Date": "2020-11-11",
  "Algoma_Public_Health_Unit": 2,
  "Brant_County_Health_Unit": 6,
  "Chatham-Kent_Health_Unit": 3,
  "Durham_Region_Health_Department": 63,
  "Eastern_Ontario_Health_Unit": 7,
  "Grey_Bruce_Health_Unit": 1,
  "Haldimand-Norfolk_Health_Unit": 5,
  "\"Haliburton": 1,
  "_Kawartha": 30,
  "_Pine_Ridge_District_Health_Unit\"": 62,
  "Halton_Region_Health_Department": 0,
  "Hamilton_Public_Health_Services": 6,
  "Hastings_and_Prince_Edward_Counties_Health_Unit": 2,
  "Huron_Perth_District_Health_Unit": 1,
  "\"Kingston": 4,
  "_Frontenac_and_Lennox_&_Addington_Public_Health\"": 20,
  "Lambton_Public_Health": 42,
  "\"Leeds": 1,
  "_Grenville_and_Lanark_District_Health_Unit\"": 0,
  "Middlesex-London_Health_Unit": 28,
  "Niagara_Region_Public_Health_Department": 468,
  "North_Bay_Parry_Sound_District_Health_Unit": 1,
  "Northwestern_Health_Unit": 0,
  "Ottawa_Public_Health": 40,
  "Peel_Public_Health": -2,
  "Peterborough_Public_Health": 27,
  "Porcupine_Health_Unit": 12,
  "\"Region_of_Waterloo": 6,
  "_Public_Health\"": 8,
  "Renfrew_County_and_District_Health_Unit": 0,
  "Simcoe_Muskoka_District_Health_Unit": 384,
  "Southwestern_Public_Health": 7,
  "Sudbury_&_District_Health_Unit": 11,
  "Thunder_Bay_District_Health_Unit": 180,
  "Timiskaming_Health_Unit": 1426
}
[{"id":"88f28a6c.5534d8","type":"inject","z":"b238e81.367b318","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":3240,"wires":[["977ca3a1.d4382"]]},{"id":"977ca3a1.d4382","type":"http request","z":"b238e81.367b318","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://data.ontario.ca/dataset/f4f86e54-872d-43f8-8a86-3892fd3cb5e6/resource/8a88fe6d-d8fb-41a3-9d04-f0550a44999f/download/daily_change_in_cases_by_phu.csv","tls":"","persist":false,"proxy":"","authType":"","x":130,"y":3440,"wires":[["6cfa7b71.18b8b4"]]},{"id":"6cfa7b71.18b8b4","type":"csv","z":"b238e81.367b318","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":420,"y":3400,"wires":[["d891dd47.daabe"]]},{"id":"d891dd47.daabe","type":"debug","z":"b238e81.367b318","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":3460,"wires":[]}]

What am I missing is this a defect?

yes looks like mishandling the headers, please raise an issue so we can track it. thanks

Done. csv node - mishadling column names that quoted and include commas · Issue #2860 · node-red/node-red · GitHub Thanks!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.