Links
Comment on page

CSV Parser

Overview

Description

The CSV Parser Flow Screen Component is designed to facilitate importing and handling CSV data within Salesforce. It enables developers and users to seamlessly parse CSV files and map the parsed data to Salesforce object fields, significantly simplifying data integration processes.
This component is handy when there is a need to import bulk data from a CSV file into Salesforce. Whether dealing with product catalogs, customer data, or complex datasets, this component streamlines the process by automatically mapping the CSV columns to corresponding Salesforce object fields.
The CSV parser component is not meant to replace tools like Data Loader. It's suitable for importing small to medium-sized data sets, but for larger data sets in Salesforce, it's better to use Data Loader or more robust tools provided by Salesforce.
  • Support large set of data (max: 50,000 rows)

Utility

The key benefits of using the CSV Parser Flow Screen Component include:
  1. 1.
    Time-saving: Importing and mapping CSV data to Salesforce objects can be time-consuming, especially with large files. This component automates the process, saving significant time.
  2. 2.
    Flexibility: The component is not restricted to a particular object or file format, which makes it versatile. It can handle different file values like ContentDocument ID, Base64, or CSV strings and map CSV column headers to any Salesforce object.
  3. 3.
    Advanced Parsing Options: The component includes sophisticated parsing options like ignoring comments, detecting delimiters, and recognizing escape and quote characters. These advanced features make it a comprehensive tool for all CSV parsing needs.

Usage

You need to configure the CSV Parser Flow Screen Component with appropriate properties. The 'object name' refers to the Salesforce object you are mapping your CSV data to. The 'file value', if provided, will make the component function as a CSV mapper for that file value. If 'hide mapping' or 'hide sample data' are set, the component will hide the mapping section or the sample data in the mapping section.
In the parser option section, you can configure properties like 'delimiter', 'escape characters', 'quote characters', and more to control how your CSV data should be parsed.

Changing the 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
This property defines the default mapping to be used when parsing a CSV file of the object.
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 “"”.
Handling Special Characters with the CSV Parser Component
If you encounter issues with parsing special characters such as "á" while using the CSV parser component, it's likely related to the file encoding. Ensure your file is saved in the UTF-8 format to prevent such problems. If the issue persists, double-check the encoding settings and try re-saving the file in the UTF-8 format again. This step should resolve any character parsing issues you might be experiencing.

Using the CSV Parser

The CSV Parser Component is powerful enough to import and handle CSV data. To use it, follow these steps:
  1. 1.
    Configure the CSV Parser component according to your data requirements.
  2. 2.
    Once configured, you must define the actions on the parsed CSV records. This is achieved by adding the next element to your flow.
  3. 3.
    For example, if you wish to create new records with the parsed data, add a 'Create Records' element to your flow.
  4. 4.
    Then, link this element to the CSV Parser component's records collection. This will ensure the new records are created using the data parsed from your CSV file.
Last modified 1mo ago