CSV Parser

The Avonni CSV Parser simplifies importing data from smaller CSV files into any Salesforce object, with options for handling various formatting.


Tutorials


How It Works

The Avonni CSV Parser operates on three fundamental principles:

Accessing the CSV File

The first step is providing the component with the CSV data. This can be achieved in two main ways:

  • Direct File Upload: This is the most common approach, where users upload their CSV file directly through the component. This allows for easy access to files stored on their local machines.

  • Using a Stored File: If your CSV file is already stored within Salesforce, you can efficiently utilize it by referencing its ContentDocument ID. This option streamlines the process when dealing with files already managed within your Salesforce environment.

Targeting the Salesforce Object

Next, you'll designate the destination for this data within Salesforce. This involves specifying the Salesforce object you intend to populate, whether it's a standard object like Accounts and Contacts or a custom object.

Connecting Your CSV Data to Salesforce

Think of your CSV file as a table with columns (like "Name," "Email," or "Phone") and Salesforce as a place to store that information. To get your data from the CSV into Salesforce, you need to tell the system how to match the columns in your CSV to the right places in Salesforce. This is called "mapping."

Example:

Let's say your CSV has a column called "Email." You'd want to "map" that column to the "Email" field in Salesforce so the email addresses are correct.

How Mapping Works

You have two options for mapping:

  • User Mapping: You can let users handle the mapping themselves. This gives them flexibility in deciding how their data should be organized in Salesforce.

  • Default Mapping: You can set up default mappings in advance. This saves time for users, especially if you're working with the same type of CSV file regularly. You match your CSV's column headers to the corresponding Salesforce fields.

Required Fields

You can also choose specific Salesforce fields that must be mapped. This ensures that essential information is always included when importing data. Users must map these fields before they can import their CSV file.


Keep Your CSV Files Organized Inside Salesforce

Instead of keeping your CSV files separate from your Salesforce data, you can now store them directly within Salesforce. This is helpful because:

  • No more searching for files: Your CSV data is stored alongside your other important information, like Accounts and Contacts.

  • Easy sharing: Need to share the data with a coworker? Just share the file like you would any other file in Salesforce.

  • Increased security: Your files are protected by Salesforce's robust security measures.

  • Stay organized: Salesforce provides tools to manage file versions, control who can access them, and keep everything neat.

How to enable this

  1. Turn on the "Save as Content Document" in the component settings.

  2. (Optional) You can also:

    • Link the file to a specific Salesforce record (e.g., link it to a specific Account).

    • Give the file a clear title.

In simpler terms

Imagine you have a CSV file with customer information. By storing it within Salesforce, you can easily attach it to the relevant Account record, ensuring everyone can access the latest information in one central location. This eliminates the hassle of searching for the file on your computer or worrying about whether you have the correct version.


CSV Parser Properties

Name
Description

Object Name

This defines the name of the object from which fields are retrieved for the purpose of mapping the CSV column headers.

File Value

This property can either be a ContentDocument ID, a Base64 encoded string, or a CSV string. When this property is provided, the file input is concealed and the component functions as a CSV mapper using the provided file value.

Required Fields to Map

These are the Salesforce object fields that need to be mapped.

Default Mappings

With "Default Mappings", you can pre-define how the columns in your CSV file correspond to the fields in the Salesforce object you're working with. This means you can set up a standard template or pattern of how data from the CSV should be interpreted and where it should be placed in your database.

Hide Mapping

When this property is set, the mapping section is hidden and mapping is done automatically.

Hide Sample Data

If set, the sample data displayed beneath the column name in the mapping section is hidden.

Parser Option Properties

Name
Description

Comments

This represents a comment identifier (e.g., # or //). Any line in the CSV file starting with this string will be ignored during parsing.

Delimiter

The character used to separate fields. If left blank, it will auto-detect from a list of common delimiters, or any values provided in Delimiters To Guess.

Delimiters To Guess

An array of delimiters that the parser will choose from if the Delimiter option is not set.

Encoding

Specifies the encoding to be used when opening local files. It must be a value supported by the FileReader API. Default is “UTF-8”.

Escape Characters

The character used to escape the quote character within a field. Default is “"”.

Fast Mode

This speeds up parsing significantly for large inputs. However, it only works when the input does not contain any quoted fields. Fast mode will automatically be enabled if no ” characters appear in the input.

New Line

The sequence used to represent a new line. If left blank, it auto-detects. Must be one of , , or .

Quote Characters

The character used to quote fields. Quoting of all fields is not required. Any unquoted field will be read correctly. Default is “"”.

Last updated

Was this helpful?