Narender Singh Brings CSV Imports to Flow

You can now upload CSV data and turn it into Salesforce records with just a couple of Flow elements, thanks to Narender’s excellent response to the 1st Chance for Glory published a few weeks back. Make sure to check out his blog at

(Interested in exporting records to CSV? Check that out here)

Here’s all that’s needed to take a typical CSV file and turn it into a collection of Accounts that you can save or modify.

The work is done by the ConvertCSVToRecords invocable action that Narender created. It takes as input one or more Content Document ID’s. This is the main way you refer to files that have been uploaded to Salesforce. In the example above, we use a standard File Upload screen component to upload a CSV file. It outputs a Content Document ID which is then fed into the new action.

The action takes advantage of the recently added support for generic SObjects in invocable actions. This is the same enhancement that enables Collection Actions. Here, at design time, I specify both the name of the object type “Account” and you select Account as the expect output from the action:

Operating Note: The File Upload component that comes with Flow requires a recordId to be provided, and it stores uploaded files ‘on’ that recordId. This makes a lot of sense when you’re trying to upload Account or Contact-related files, but doesn’t make a lot of sense here where we’re just trying to import data. As the video here shows, I actually created a separate object just to hold these values.The import process doesn’t actually make use of this related record. This is all a little annoying, and hopefully someone will come up with a File Upload component that doesn’t have this requirement.

CSV File Considerations

The first row of your file should consist of the field names you want to upload. Make sure you use apinames, include “__c” for your custom fields, and pay attention to the required fields for the records you’re uploading. Note: there should be no NULL values in the last column of CSV.



Object API NameRequired. Tells Flow what to convert your data into. Example “Account”. Make sure your CSV file has all the required fields
Content Document IDA single Content Document record ID string

List of CSV File IDs
Collection of Strings.


A collection of Records

Install Package

Version 1.01 – 6/13/20 -removed export files, as they have been obsoleted by this work.

Old versions

View Source


Notify of
Inline Feedbacks
View all comments
Adam White

Looks like we were beaten! Nice job Narender.

Alex, what were some of the use cases for this? I’d assume it’s for power users / org champions that might not be able to get elevated privileges to do mass record loads?

Alex Edelstein

I think this is a little more nimble and flexible than the old guard of data upload tools. In particular, the flow approach emphasizes the ability to chain different tools in a sequence. Many times, you want to not just create the records from a CSV file but also modify them first.

Adam White

So I’d actually like the inverse of this – I want a CSV generated from a given sObject collection, or even the output of a SOQL query using ExecuteSOQL.

This would be quite powerful in situations where SF Reports can’t do what you need it to do (which is often, sadly). Schedule a flow, use ExecuteSOQL to build your collection, use our handy dandy de-duper action if needed on the collection, then generate a CSV and use the Send Email action from here on USF.

I might have my team work on that if nobody else wants to.

Adam White

Definitely – where I get hung up is how to combine it with ExecuteSOQL as well as any ole’ ‘Get’ step. Like it would be super powerful to have the ExecuteSOQL action include some Counts / groupings in SOQL and have that output to the CSV, but that might increase the complexity quite a bit.

Adam White

Awesome – stay tuned!

Adam White

Alex – what about apex defined types? let’s say I had a series of unrelated objects and I wanted to create a bunch of joins that aren’t supported in SOQL. we could potentially create an apex-defined type with some associated records and then pass that into the CSV, is there something like that we could do generically?

Gidi Abramovich

Well done, Narender!
Thanks, Alex, for your demonstration.


Narender Singh

Hey Alex,
Quick suggestion: You may want to update the ‘CSV File Considerations’ and that there should be no NULL values in the last column of CSV.

Vinay Vernekar

Nice Article, Its very useful. Just wanted to know its not possible to use in Professional edition right?


The link to GitHub is broken and couldn’t install from package, getting test class failure. Please check

asher Diba

wasn’t able to install also…

Scott Landes

I’m also not able to download – the error says it’s been deprecated from the AppExchange. Is there a new link I can install this from? Thanks!
“The AppExchange package has been deprecated and can no longer be installed. Please try installing a newer version, or contact the package owner directly to resolve”

Screen Shot 2020-06-01 at 4.43.48 PM.png

[…] CSV invoked action for you all. I consider this the inverse of Narender Singh’s ‘Create Records from CSV‘ action. We built this to fully utilize some of UnofficialSF’s awesome custom actions […]

[…] Couldn’t find the time to post this sooner, kudos to Alex for doing the article on it. Click here to read more about the details of Flow Apex […]


Bad link to version 1.01

Dan Brown

The link to install version 1.01 is broken, can this be fixed so I can test out this package? This is exactly what my company is looking for, I appreciate it!

Dan Brown

Thank you!

Patrick Clarke

Hi Narender. When I try to run your action (called ConvertedCases) in my FLow, I’m getting the error “Error element ConvertedCases (FlowActionCall).
The “ConvertedCases” element in your flow has validation errors.”

Any ideas what I’m doing wrong?

Thank you.

Allen Moy

This is a great tool. It allows us a simple way to move data from an external system into Salesforce without manual entries. One of our users got this odd error today:
Error Occurred: An Apex error occurred: System.ListException: List index out of bounds: 0 
When a system admin tried with the same csv file, it worked fine. Any idea what that error means in this context?

Garrett Lietzen

I’m using this to try and upload records with a date field, but I keep getting an error:

Error Occurred: An Apex error occurred: System.SObjectException: Illegal assignment from String to Date

Is it not possible to upload files with date fields? I’ve tried with different formats such as mm/dd/yyyy, yyyy-mm-dd, etc.

Marcus Neal

I am trying to add a related record id to the apex code, so when i assign the flow to a specific record page, and select the upload flow once completed the new created records will be assigned to related record?

Jon Shipp

This is a great component. I had two issues with the component that I had my programmer make adjustments to handle. First, I was working with a client that did not want to change the column names of the CSV file that came from another system to Saleforce API Names. We created a metadata cross reference table and adjusted the component to ask for the API name of the meta data table. The code imports just the columns that are in the Metadata table and translates the CSV column names to Salesforce API names. We also added capabilities for date… Read more »


where is installed packages for sandbox? great job i need this

Robert Cooper

My install failed because of 203 different apex compile failures. Is there something I’m doing wrong?


hi Robert, when you install the package, just below “Install for Admin only” option, there is a drop-down menu. Expand it and select “compile Apex only in this package”. Then the installation will be successful.


For me, both the packages (old and new) fail to install. Do you know how I could fix it? I was really looking forward to this component for a project I’m doing in the company. 1. Apex compile failure Apex class AuraAccountShowUp: line 113, column 10: Variable does not exist: isValid 2. Apex compile failure Apex class AuraAdjustLevel: line 25, column 13: Variable does not exist: isValid 3. Apex compile failure Apex class AuraAdjustLevel: line 31, column 12: Variable does not exist: isValid 4. Apex compile failure Apex class AuraAdjustLevel: line 36, column 13: Variable does not exist: isValid 5. Apex compile failure Apex class… Read more »

Alex Edelstein

Those are unrelated classes in your org that are now broken and failing to compile. To install anything on that org you need to address, perhaps by just deleting them

Aaron S

I can’t for the life of me get this thing to take percentage values, even when formatted the same as the DataLoader tool. Any chance you can include a list of supported field types and examples of how those fields should be formatted in the csv.

Aaron S

ok, well since I figured it out. There’s a whitelist in the code of which field types are supported: Boolean Double Currency Integer String Anything that doesn’t fit into the first 4 are automatically treated as strings, hence the “Illegal Assignment of String to Decimal” error I was getting… These are down on line 77 of the version 1.01 linked above: If you need to support percentages or other data types, you’ll add them as I’ve done in the snippet below (see PERCENT): static Object getConvertedFieldValue(Schema.DisplayType fieldType, String fieldValue){             Object convertedFieldValue;      … Read more »