Search through more than a hundred articles on every aspect of User.com

Alina Shafikova
Written by Alina Shafikova

Events import via CSV file

Learn how to add Events into your database via CSV file


Before you start

Prepare your CSV file with the following in mind:

  • Always include column headings.
  • If you are exporting a CSV file from Excel, make sure there are no cells left out.
  • Data format matches the data format of your attributes. So if you have an attribute "Scoring", which should include an integer, it doesn't make sense to put its value as "Frank". If you are exporting from Excel, make sure that you set the correct data formats for each cell.

Take note: Deals CSV importer interprets the following columns:

  • user_id (string) - Unique ID provided in user model
  • email (string)
  • datetime (date time) - format "YYYY-MM-DD 12:02:01"
  • event_name (string)
  • attrs (JSON object) - { "key": "value"}

Event attributes should be placed in a specific way - each "key": "value" pair has to be pasted in another column. As an example, we've got an event with three attributes:

Note a few things:

  • there is no separator between objects,
  • each specific object is placed in the other column,
  • not forget about closing curly bracket.

You can find an example file here.

How to do it

  1. Go to Settings > Importers > Import Events.
  2. Prepare your Events list in .csv format as in the example provided in every import section found on that page (email, datetime, event_name, etc.).
  3. You have the option to drag and drop or click the box to upload your CSV.
  4. The Encoding has to be selected as UTF-8.
  5. Choose the Separator that you have used in your CSV.
  6. Once all previous set has been set up, click on the Import . Then the import process will begin, and your import will appear at the bottom of the list of imports.

Google Sheets file edit

While editing your file in the Google sheet, there is one important rule. Every attribute object has to be inside single quotes, e.i. "key". Unfortunately, Google sheet omits a quote if it appears as a first character in the line. To get rid of that problem, you have to type a single quote twice. This way it'll be correct in that Google sheet and the csv file after it's been exported. Example:

Related articles:

Categories: