Search HoldMyTwist

Browse all posts

Parse CSV in Make without shifting quoted columns

Keep the correct columns for quotation commas, empty cells, quotation marks in CSV. Follow Make Free example with 2 rows and check both results.

Paper parcels in three coloured lanes with two brass beads kept together in one aqua envelope

If you are splitting the columns on every comma when parsing a CSV, you can end up with the values in the wrong columns. Here's a use of CSV > Parse CSV in a Make Free exercise to ensure a quoted item name, blank note, and quotation marks are in the proper columns.

Before you start

First you need Make account, You can create Make Free account (opens in a new tab) or login. You don't need to integrate any app, these in-built modules. Let keep this practice scenario Inactive. Use Run once

1. Paste a small CSV sample

In Scenarios => Create scenario => top left name it something. For example Quoted CSV practice => big plus click => search for CSV => select builtin Parse CSV module => CSV contains headers set it to Yes. CSV headers (recommended) value put this EXACTLY: item,quantity,note (notice! no space between header names and comma's). Delimiter - still Other. Delimiter character - comma. In CSV paste this sample (start)

Row "Notebook, pocket",2, - 1 item name is "Notebook, pocket" qty 2. note - empty. notice the comma inside quotes - this is a part of item name.

Text to copy

item,quantity,note
"Notebook, pocket",2,
Pencil,1,"Said ""hello"""

Full Make editor showing CSV headers, comma delimiter and a quoted two-row CSV sample

Full Make editor showing CSV headers, comma delimiter and a quoted two-row CSV sample
Open full-size image

The 3-line (one header item,quantity,note) CSV starts off with item,quantity,note. First data row is a single item (Notebook, pocket) qty 2 and blank final note. The comma within the quote is part of the item name. The second comma after 2 keeps the final note blank. Second data row, Pencil, qty 1. Note is Said "hello" (the pair of double double-quotes within the quote for the CSV note is a single literal quote mark).

Watch out

Don't drop the quote for a cell that has a comma in it. If you do, it will end at a different place. Don't trim empty cells. The comma after 2 makes the note empty. Correct the source punctuation before you map the fields to an action.

2. Run and inspect both rows

  1. First, save the module. 2. Then save the scenario. If you see the warning message that output is not used, choose Save anyway 3. Now Run once. If you get the same warning, choose Run anyway. 4. Now click on execution result bubble just above the CSV. Look at each bundle output (data is per bundle. One row of data for a bundle) in Output

Full Make editor showing two parsed CSV bundles with an intact quoted comma and empty note

Full Make editor showing two parsed CSV bundles with an intact quoted comma and empty note
Open full-size image

Bundle 1 -> item : Notebook, pocket, quantity : 2, note : blank

Bundle 2 -> item : Pencil, quantity : 1, note : Said "hello"

and so on. Note that the header is not an additional row of data.

If values land in the wrong columns

Reader just read as text that is csv. Check delimiter. If its semicolon export you need semicolon. Reader check number of header columns and order with the columns. This is copy and paste csv text. You need to first export an excel workbook to copy csv to do that. If you got message from make. Number of columns on line 2 not match with header. You need to check record with header. This example you need 3 fields. Item, quantity, note. Even if last note is blank. You need to have comma after 2 at the end of that row. If you delete it you only get 2 fields. And then you get error. So you need to have surrounding quote. So you have all notebook pocket. And you keep internal comma. If you remove these then you break your item. Now you have 4 fields. So make sure you have 3 lines sample like above. Save your module and scenario. Run it once. Make sure you see both of Output bundle before you add other action. If it's real export. You need to confirm fields you want with reader source. Don't just remove quotes. Or add empty cells. Or remove quotes to stop making error for noise. This can change your record. Make is nice if you need to do it many time. You might want to use a spread sheet or text editor for once. Start Make Free (opens in a new tab). Check Free plan limits. Before you put actions on schedule.

Sources: Make CSV modules (opens in a new tab); RFC 4180 CSV format (opens in a new tab). Screenshots show Make with fictional practice data.

Share this post