- 14 Dec 2021
- 3 Minutes to read
- Print
- DarkLight
Import Excel or CSV (Runtime Mappings) Step
- Updated on 14 Dec 2021
- 3 Minutes to read
- Print
- DarkLight
Overview
The Import Excel or CSV (Runtime Mapping) step takes in CSV/Excel sheet file data as input and maps the desired column(s) data to a Decisions object list as output.
This step bears similarity to the Import Excel or CSV step in that it can be used to import an Excel or CSV file into a Flow, but differs in that it allows the user to add a List of mappings dynamically at Runtime.
There is a simple project with a demonstration of this step available and can be downloaded below, as well as the excel sheet used in this example.
Glossary Entry
Step Name | Description | Location | Inputs/Outputs |
---|---|---|---|
Import Excel or CSV (Runtime Mappings) | Takes in a CSV or Excel file and maps the desired Column data to a Decisions Object List at Runtime. | Integration > Excel and CSV | Inputs: File Data [FileData], Mapping [List of DynamicCSVMapping], Input File Type, Start on Row, CSV Delimiter, Ignore Quotes (Do not treat as escaped), Input File Encoding Outputs: Actual Columns Number [Int32], Input Line [String], Line Number [Int32], Column Number [Int32], Error Message [String], Source Value [String], Target Type [String] |
Example
Begin in a Designer Folder. In the bottom action panel select Create Flow. Create a default flow and name it Import Flow.
In the workflow designer select the Start step. Under Flow Data > Flow Input Data, select Show Editor, then name the data Excel Sheet and in the type drop-down choose FileData as the data type.
The Import Excel of CSV (Runtime Mappings) step requires a list of DynamicCSVMapping type as an input to instruct the step on how to parse the sheet data to the desired columns.
On the outcome of the Start step add the Create Data step found in the Steps Panel in the category Data. In this example, we re-named the step, Create Mapping Data to clarify its purpose. Under Data > Data to Create, select Show Editor, name the data Mapping Data and in the type drop-down menu chose DynamicCSVMapping as the data type.
The DynamicCSVMapping type allows the definition of which column number(s) (important: column index number starts at 0), which column name(s), and the data type(s) of the desired column(s) for to be mapped for output from the step.
Import Excel or CSV (Runtime Mappings) Step
The step's Output Data Type property also must output a data type(Flow Structure works well here) that at least contains data members whose names and types exactly match that of the desired columns and column data types, respectively. If there are data member names missing from the data structure and the DynamicCSVMapping expects those column names then the step will error.
Under Error Handling there will be Extra Columns in Input, Less Columns in Input, and Value Conversion Error. There are three options in the drop-down menu: Add Outcome, Throw Exception, Ignore and Continue. In this example chose Add Outcome for all three Error Handlings.
Under Input Data > Input File Type select Excel_xlsx from the drop-down menu. Start on Row 2 as in the excel sheet used in this example the first row is used as a header row.
For this example, the Output Data should be the AccountInformation Data Type. So under Output Data > Output Data Type, select AccountInformation.
This step takes in File Data and Mapping. For File Data select Excel Sheet from flow. For Mapping select Mapping Data from flow.
The outputs on the Import Excel or CSV (Runtime Mapping) step are set to Rename by default. For this example leave these alone.
Debug
The example flow is complete. In the top action panel select debug. Before running the flow add the excel sheet as an input for the flow then select Run. Upon running the flow in the debugger select the Import Excel or CSV (Runtime Mapping) step, chose the View Input/Output Data from the action menu. Here view the data imported from the excel sheet.