Per a customer request on a MS Q&A post, sample application in this repository performs CSV to XML conversion leveraging the following features:
- Azure Blob connector for detecting an upload of a
.csv
file incsv-files
container in Azure Storage account. - Inline Code action for parsing through the content of the
.csv
file and constructing an array of JSON objects where the CSV header values are used as their property keys, and subsequent row of values are specified as their property values. - Compose action is used for utility purposes for tasks such as base64 decoding as well as making it easity to work with Transform XML action.
- Foreach loop is used for iterating through the array of JSON objects as we assume each row equals different xml file at the end of the workflow.
- Transform XML action is used inside the Foreach loop to perform (a) JSON to XML conversion (b) XML transformation using Map file (resides in
Artifacts/Maps
directory). - Upload Blob action is used to create a new blob file inside the
xml-files
container in the same Azure Storage account.
Assuming the following CSV file with n
number of rows & colums:
MTCCode,SN,Quantity,Type,DN,Cx,Delivery-Time,Due-Date,FCNW,PFDT,PTDT,DFDT,DTDT
12345,987654321,24,staged,durham,cust name,6:00:00 AM,22/9/2022,24,22/9/2022 6:00am,22/9/2022 6:00am,22/9/2022 6:00am,22/9/2022 6:00am
54321,987654321,24,staged,durham,cust name,6:00:00 AM,22/9/2022,24,22/9/2022 6:00am,22/9/2022 6:00am,22/9/2022 6:00am,22/9/2022 6:00am
23421,987654321,24,staged,durham,cust name,6:00:00 AM,22/9/2022,24,22/9/2022 6:00am,22/9/2022 6:00am,22/9/2022 6:00am,22/9/2022 6:00am
The workflow will result in 3 separate xml files in the xml-files
container of your Azure Blob Storage account.
- This conversion doesn't require Integration Account or Azure Functions resources to perform the conversion
- Because Logic Apps Standard runs on Azure Functions runtime, you'll need to create your own
local.settings.json
file with necessary connection strings to be able to run this workflow locally which are specified in theconnections.json
file. .vscode
is available, so you should be able to open in VSCode and debug withF5
accordingly.- For more info and additional support, please inquire the original MS Q&A thread: https://learn.microsoft.com/en-us/answers/questions/1025481/index.html