CSV Files as an External Data Source

You can import .csv files into Sandstorm to import data into your account. We’ll accept both one-time uploads and a recurring import of .csv files from your Amazon S3 Bucket.

We recommend you read People, Events, and Properties and Common Methods before getting started here.

File Format

Columns will have the bold titles. You will need at least 3 columns for a successful upload - two standard, and one variable. These are the two required fields:

  • Identity” (required): Each entry is a KM identity. We will accept both new identities and identities already in our database.

  • Timestamp” (required, except when importing aliases): Each entry contains a timestamp of when the event/property occurred. The time format is in seconds as a UTC Unix epoch. If you are using dates in Excel, you may need to convert those dates to Unix timestamps. See this answer on Stack Overflow. Be aware that Unix timestamps are calculated based on GMT, which may affect the way you convert times to Unix timestamps. We also have an example .csv available for download at the end of this article with annotations describing the steps to convert a date to Unix.

Then include at least one of these three columns, depending on what type of data you’re importing:

  • Event” (optional): You can add an event name, such as Signed Up. It does not matter if you currently have data for this event, or if this is a completely new event. If you are importing events, each row needs an event. To set only properties, set those aside in a separate CSV file.

  • Prop:”Property Name (optional): You can add property columns by giving them the title Prop: and then adding the property name. For example, Prop:Age or Prop:Billing Amount.

  • Alias” (optional): in the rare case you are uploading aliases, you can add additional aliases to the KM identity.

In the case of Events, Properties, and Timestamps, you can send in a placeholder for any of these if the timing or event is unimportant. Whether it's dummy data or not, you still need to meet the above requirements, but all the dummy data can be the same throughout the whole column.

Our CSV import is unable to accept double quotation marks (“), so please use single quotations (‘) if possible.

Download pre-formatted CSV for upload

Use the template below to help get started. Feel free to add more Events and/or Properties.

Pre-formatted CSV Upload

📘Unix Timestamp

Note that the Unix conversion is still a little tricky. You will put your readable dates in Column B. Column C has a pre-entered conversion formula in it that will convert these readable dates to Unix. Before you upload the .csv though, you'll want to delete Column B (the readable dates). In order to maintain the Unix dates in Column C post-deletion, you'll need to copy Column C and re-paste as hard coded values. Then you can delete Column B with no effect on Column C.

📘Existing data

Also note that if you're importing Events or Properties that currently exist in your Sandstorm app, you will need these to match exactly what you have on your CSV. Otherwise we will think it's a totally different Event or Property.

Examples

Importing only events (record command)

Importing events with optional properties (record command with properties)

Importing only properties (set command)

Importing optional aliases (alias command)

It’s uncommon to upload aliases, but this is the format if you absolutely needed to:

Last updated