Data import using CSV or Excel is a feature that is been there since day one. It is a good end user feature that helps to import data quickly in to Dynamics. Using predefined data maps and template the data can be quickly imported without much effort. The log is also a great addition to know the import status.
If you want to import data using Power Automate, read the CSV or Excel, parse and create the record one by one. The drawback on that approach is that, API request limitation will make the flow throttle if the data volume is larger. But if we use the standard data import using Power Automate Flow that will be robust and have more logging on the status of the import like the failure, success, error message etc.
Now, we will see how we can do the data import process using Power Automate Flow. Firstly we need to read the CSV file using some source, either using a SharePoint location or anything. Once the CSV is parsed and read, the first thing we need to do is to Create a Data Imports record as below.
The next step is to add the Imports record using the below step. The content attribute needs to get populated with the file content. The Import Job ID is the id that is created in the above step. Data Map can be an id of the Data Map config that is created for the CSV template. If you want to auto map then specify Use System Map as Yes (beware this will auto map by the system which you won’t have control over). Target Entity needs to be the entity schema name that you are importing.
Now that by creating the Imports record the import get to submitted status. The next step in the import process is parsing the CSV. This can be invoked using the bound action for entity Data Imports named ParseImport. The Row ID will be the id of the Imports record that is created in the above step.
The next step is the transform step. This can be accomplished using another unbound action named TransformImport. ImportId is the id that is created in the second step.
The next step is to start the import process. It can be triggered using the bound action ImportRecordsImport for the entity Data Imports.
Note, each of the action invoke will have a system job running in the backend. Make sure you check the system job get succeeded before you invoke the next action. This can be accomplished using the do until step.