Documentation & FAQs

Documentation to integrate EasyCSV with any app, API, or Zapier.

How to create an import form

Step 1: Click the "New Sheet" button

After logging in you will be brought to your list of spreadsheet imports. Click the "New Sheet" button.

Step 2: Configure spreadsheet import

Specify all required fields.

Pro Tip:
You do NOT have to specify an API/Webhook endpoint URL for testing the form. It can be added later when your application is ready to start accepting imports.

Step 3: Specify required and optional columns for spreadsheets being imported

In the navigation above the spreadsheet form click on "Columns & Rules".

Add any new column rules you want. You can specify if they are required. You can also choose the required data format.

When a user attempts to import a spreadsheet, EasyCSV will validate every field has the right data format and tell the user if there are any errors they need to resolve in order to finish the import.

How to process the data in your API/Application/Webhook

Step 1: Create a public API/Webhook endpoint and specify in the spreadsheet import settings

Create a public endpoint that accepts a POST of either JSON (default & preferred) or Form params data (can be chosen in the spreadsheet import form settings).

Log in and go to your spreadsheet import form. In the top nav click "Sheet Details".

Click the checkbox to "Post imports to Webhook". Then type or paste the URL of your public API/Webhook endpoint.

Step 2: Handle the incoming request from EasyCSV

Your endpoint should accept the incoming data. Validate the data is correct and safe to save. The data will come in as one http POST per row/record of the spreadsheet being imported.

Here is some example JSON that could be sent to your API/Webhook for each record (you can customize the JSON EasyCSV sends. Read section about customizing below):

{
  "import_id": 12345,
  "import_name": "product_list.csv",
  "importer_email": "example@yourdomain.com",
  "sheet_name": "Ecommerce Product Listings",
  "sheet_slug": "product",
  "sheet_id": 67890,
  "import_code": "gft6353ruy7",
  "record_data": {
    "product_name": "Widget",
    "product_description": "Change channels on your TV.",
    "price_in_cents": 1000,
    "homepage": "https://www.widget.com?utm_source=amazon"
  },
  "virtual_fields": {
    "website_root_domain": "widget.com"
  }
}

Keys that will be present on every request for every record/row:

  • import_id
  • import_name
  • importer_email
  • sheet_name
  • sheet_slug
  • sheet_id
  • import_code (this is most likely going to be null. Read more here.)
  • record_data
  • virtual_fields (empty unless virtual output fields are configured)

Values that can CHANGE on every request:

  • Keys & values nested under record_data & virtual_fields will be unique per record/row of the spreadsheet being imported. Spreadsheet column titles are the keys for record_data.

Pro Tip #1:
You may want to write your code to not allow duplicate records/rows to be imported IF your system needs things to be unique. If your system allows many objects with the same content, then simply process and save each incoming record/row.

Pro Tip #2:
You may want to save the import_id or other info on any records you create in case you want to delete or fix data from a specific import.

Pro Tip #3:
You may have a use case where you want to save things imported as a "draft" needing approval from an admin.

How to send multiple records at once using bulk chunk uploading

Step 1: Create a public API/Webhook endpoint and specify in the spreadsheet import settings

Create a public endpoint that accepts a JSON POST request.

Log in and go to your spreadsheet import form. In the top nav click "Sheet Details".

Click the checkbox to "Post imports to Webhook". Then type or paste the URL of your public API/Webhook endpoint.

Step 2: Enable bulk chunk uploading

In the same "Sheet Details" form click the checkbox labeled "Post multiple records at once in bulk chunks".

Specify how many records your endpoint can handle at one time. The minimum is 100 records per POST request. If you need less than this per request please contact support@easycsv.io for an exception or do not use the bulk chunk upload option.

Click the save button and try an import.

The JSON posted will be an ARRAY of multiple records from the example above for sending single records to your webhook. You can also customize the JSON you plan to POST.

How to send a test row to your webhook

Step 1: Add your API webhook URL to your sheet

If you have not already specified a public API webhook URL for your spreadsheet then click edit on the sheet and add one.

Step 2: Click the 'Send Test Row' button.

If you are logged in as an admin, view the spreadsheet import form. You will notice a 'Send Test Row' button in the right side column. Simply click it!

How to import a CSV from an email sent to EasyCSV

This functionality is great for these use cases:

  • Somes apps let you scheduled report exports as CSV files that are emailed to you. Set up the scheduled export email with attached CSV to go to your EasyCSV email address and have it auto-import.
  • Some app or service will email you a CSV with data on a regular cadence. Have that app or service email your EasyCSV email address to import the data automatically and send it where it needs to go.

How it works:

  1. Click the "Sheet Details" link at the top of an import page when you are logged in as the import page owner.
  2. Click the checkbox "Import sheets sent via email as an attached CSV".
  3. You will see a list of options expand as well as the unique email address for this sheet import page.
  4. Set the options the way you like.
  5. Any email sent to the unique @parse.easycsv.io email address with a CSV file as an attachment will be auto-imported when this option is enabled.

How to import a CSV by posting to an EasyCSV API Webhook

  1. Click the "Sheet Details" link at the top of an import page when you are logged in as the import page owner.
  2. Click the checkbox "Import sheets posted to API Webhook".
  3. Copy the url shown for the POST request.
  4. Set the param options the way you like:
    key value
    api_key your API key (get API key by clicking "Business Info" in the top nav after logging in)
    public_file_url publicly accessible URL to the CSV file
    importer_email email where import results are sent (optional)
    import_name Name of this import (optional - we will take file name from URL is this is not specified)
  5. Send POST requests to the endpoint with the proper attributes.
  6. Check the import log table at the bottom of the import sheet page to see results of your imports.

How do I customize the JSON I want to post?

Use the EasyCSV feature: "Custom JSON to post". You will find it at the top of your sheet import page if you are logged into EasyCSV and are the admin.

Let's say you have a CSV file you want to have imported to your webhook or another destination API. The column headers from the CSV file you want to import are: first name, last name, email address, street address.

Let's say you want to combine the first and last names into one field (Full Name) and you want all the column headers to be top level keys in the JSON. You also want to change the email address to just be: email. Here is what you will put in the text area on the Custom JSON to post page:

{
  "Full Name": "{{ FIRST_NAME }} {{ LAST_NAME }}",
  "Email": "{{ EMAIL_ADDRESS }}",
  "Street Address": "{{ STREET_ADDRESS }}"
}

You will see values from the importing sheet need to be surrounded by curly braces {{ }}, capitalized, spaces become underscores _ , and also surrounded by double quotes " ". The JSON keys will be what the destination API is expecting. So try to match those exactly to what that API is looking for.

Tip: On the Customize JSON to post page you will see some helper text that tells you how to write variable names to be populated from column rows of the CSV file you want to upload.

How do I add an Authorization Header or a different custom header?

After logging into EasyCSV, navigate to your sheet import page. At the top of the page, when logged in, you will see a link for "Request Headers". Go to that page to add authorization and other custom headers.

To add an authorization header put in these values:

  • Key:
    Authorization
  • Value:
    <authorization type> <the authorization token>

Example:

  • Key:
    Authorization
  • Value:
    Bearer 12345abcde

All header values are encrypted in the EasyCSV system for security.

Failing a record/row instead of importing it to your application

If you need to fail a record you should return a proper error code in the 400 or 500 range with a response body giving the reason. All failed records will be shown to the user with the reason (response body you return to EasyCSV) why they failed so the user can try to fix the problematic records and re-import them.

How to limit access for spreadsheet import - 4 options

Simple Password

Specify a simple password a user has to enter to see the spreadsheet upload form.

Require Google Account login to import

Users will be required to sign-in with their Google Account before importing spreadsheets.

Require that a user's email address is for a specific domain

Requiring Google Account sign-in first is a pre-requisite for whitelisting email domains. After specifying a list of acceptable email domains, if the user's Google Account email address is not for an email domain in your whitelist then they will not be allowed to import spreadsheets.

Trade unique tokens with your app for trusted uploads

Step 1: Create any string to add as an import code when a user wants to make an import into your application. Either generate the import code in a unique way only your system knows is real or save the import code to lookup it's validity later.

Step 2: Force your user to click on a link to go to your easycsv.io spreadsheet upload form. Append the unique token/code to the url with "?import_code=12345example". Full example: https://www.easycsv.io/company_slug/sheet_slug?import_code=12345. This code will flow back to your app when your users does an import.

Step 3: In your API/Webhook look for the "import_code". Fail any imports that do not have an "import_code" or if they have an "import_code" your system doesn't recognize.

Virtual Fields: How to I take part of a value, combine values, or map a column name to another from the importing spreadsheet?

We recommend you do this with our Virtual Output Fields solution.

Step 1: Have an admin navigate to the Sheet import page.

Click the "Virtual Output Fields" link in the top navigation.

Step 2: Create a new Virtual Output Field Rule

Select up to 5 spreadsheet columns you would like to combine when importing.

When selecting each column you can perform some common actions on the data being imported. Examples: Captialize, Extra things from URLs, Count characters, and many more...

Step 3: Update your app to check for Virtual Fields

Use the "virtual_fields" part of the JSON being posted to your endpoint to import this extracted and transformed data.

Common Virtual Field Use Cases

Use Case What column name to use for your Virtual Field and action Ruby Regular expression to use
Get the file name WITHOUT the file extension from an attached CSV file emailed to EasyCSV for import Column: EasyCSV - Import name
Action: Extract text with Regular Expression
(.+?)(\.[^.]*$|$)

test example file name
Get the word immediately after some matching text in the email body sent to EasyCSV for an import Column: EasyCSV - Email Body Text
Action: Extract text with Regular Expression
Let's say you want the word immediately after "Unique ID:" and there is a space seperating

(?<=Unique ID:\s)[^.\s+]*

test example email text
Get last word from the subject line of an emailed import to EasyCSV Column: EasyCSV - Email Subject Line
Action: Extract last word

How can I test my Regular Expression?

Use this handy Ruby Regular Expression Tester

How to setup Slack + EasyCSV

Step 1: Get Webhook URL for your Slack workspace

Go here and follow directions under the 'Setup Incoming Webhooks' section: Get webhook for Slack workspace

Step 2: Copy & Paste webhook URL in EasyCSV

Copy your webhook URL from Slack. It will look like this: https://hooks.slack.com/services/12345/abcde/easy123789

Login and click on "Business Info" in the top nav dropdown menu. Access if by clicking on your name in the upper right corner after logging in.

Paste your webhook URL in the "Slack Webhook URL" field.

Click save and you will start seeing info about imports being saved in the Slack Channel you specified for the webhook.