CSV Parser
Last updated
Last updated
The Avonni CSV Parser component makes importing data from CSV files into Salesforce easy. It helps you import and organize the data and connect it to the correct fields in your Salesforce objects, simplifying and making it readily usable.
The Avonni CSV parser component is great for importing smaller files into Salesforce (think spreadsheets). If you have a big dataset (over 50,000 rows), you'll want to use the Data Loader tool instead. It's designed for those larger imports and offers more features.
The Avonni CSV Parser component will:
Saves you time: Instead of manually importing your data, this tool works for you and is especially helpful with large files.
Works with any Salesforce object: You're not limited to just a few specific objects – use it with any data in Salesforce.
Offers advanced options: You have fine-grained control over how your data is imported, with options to handle comments, different separators, and special characters.
The Avonni CSV Parser operates on three fundamental principles:
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.
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.
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."
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.
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.
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.
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.
Turn on the "Save as Content Document" in the component settings.
(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.
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.
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.
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 “"”.