
Hey All,
I'm currently working on a flow that reads a csv received daily, compares the data in some table in azure and then adds the data to the table if it is not already present.
There doesn't seem to be a connector to read csv nicely so I just fetched the file content and then converted it to string from base64.
I then split the data into rows, with the first row being the headers of the data (each column is comma separated) and every row after that is the actual data (also separated by commas).
Wondering if there is an easy way to convert this data to an array of objects as that is the output of the azure table when I query it and it would make it easier to compare with the csv data.
This is a sample of how the data is formatted
[
"first name, last name, address", email",
"bob, white, 4367 st, bob@gmail.com",
"frank, blue, 9849 ave, frank@gmmail.com",
...
]
I've removed the header from the rest of the data and then split by comma so I have an array representing headers like
["first name", "last name", "address", "email"]
and can do the same with the rest, but unsure then how to connect into a an array of objects. I tried a select operation but it is throwing an error.
Any help is appreciated.
Hi @fabiofa ,
I've made a test for your reference:
1\My flow
Apply to each
skip(variables('OrigionalArray'),1)
Compose
variables('OrigionalArray')[0]
Append to array
{
"@{split(outputs('Compose'),',')[0]}":@{split(items('Apply_to_each'),',')[0]},
"@{split(outputs('Compose'),',')[1]}":@{split(items('Apply_to_each'),',')[1]},
"@{split(outputs('Compose'),',')[2]}":@{split(items('Apply_to_each'),',')[2]},
"@{split(outputs('Compose'),',')[3]}":@{split(items('Apply_to_each'),',')[3]}
}
2\Result
Best Regards,
Bof