Merge Data from a CSV (spreadsheet)

Have a spreadsheet (CSV) full of data that you want to merge into your documents?  You can easily upload your CSV to either a document or a data route and we'll generate a document for each row in the spreadsheet.

After you've built (and tested) your document/data route, go to the Merge tab and then click on the Upload Data button.  On this page, you'll be able to upload your CSV file (or provide a link to a file on the web).  The columns in your CSV file will contain the "field names" and the rows will contain the values for those fields.  If you don't already have a CSV file built, you can click on the "Click here to download a CSV template for this document" link that will have the "field names" for your template already populated, so all you have to do is enter the field values.

2021-05-25_14-02-36.png

After you've uploaded your spreadsheet, you'll be taken to a page where you can match up your merge fields with the columns in your spreadsheet.  You'll need to match up all of your merge fields so we know where to put the data in your template.

mceclip0.png

Once you have matched up all of your merge fields with the columns in your CSV, you're ready to merge the documents!  Click the Merge the Data button at the bottom of the page and we'll populate a document for each row in your CSV.

You'll be able to see the status of your merge by going back to the Merge tab and clicking on Upload Data.

Testing and Advanced Options

The CSV upload function has some additional options which you may wish to utilize.

Use Test Mode (only 3 rows - please use test data)

Use this option to confirm that the field mapping options are correct before uploading "real" data.  This will only use the first 3 rows of field values in the uploaded CSV.

Combine documents into single doc

If you need a way to combine all the documents generated from your CSV into a single document, click on the Advanced Options button then select the "Combine Documents" option.

 

mceclip1.png

 

Use all rows in a single merge

If you need a way to send all rows in the CSV to a single document, rather than individual documents, you will need to set up a loop in your document using the $_rows merge field like this:

Name Date Event Name
{tablerow from=$_rows item=_row}{$_row.name} {$_row.date} {$_row.event_name}{/tablerow}

The value after the "dot" in {$_row.name} is the name of the column (all lowercase) in our CSV.

Prior to initiating a merge here, you'll want to make sure the "Use all rows in a single merge" option is selected.

 

mceclip2.png

 

Group rows by a field

If you need a way to group the data by a certain field in your CSV (customer, order ID, etc) so that certain rows are sent to different documents, you'll first need to setup a loop using "$_rows" in your document like in the section above.

Finally, when you go to merge the document and upload your CSV, check the option to "group" rows by a field under Advanced Options.  You can select the field by which you wish to group via the dropdown menu, as shown below.

 

mceclip3.png

Was this article helpful?
1 out of 2 found this helpful

Comments

0 comments

Please sign in to leave a comment.