question

Tanvi-6143 avatar image
0 Votes"
Tanvi-6143 asked MayankBargali-MSFT commented

Import CSV into Table storage using logic app

Hi,

I am trying to import a csv file stored in a blob into an azure table using the logic app. I have set a trigger to identify an addition/modification in the blob and subsequent actions to get the blob content and store it in an array, however I'm not sure how to proceed from here.

Help would be much appreciated

Thank you!

azure-logic-apps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MayankBargali-MSFT avatar image
1 Vote"
MayankBargali-MSFT answered MayankBargali-MSFT commented

Hi @Tanvi-6143

Welcome to Microsoft Q&A! Thanks for posting the question.

As you already had your CSV content in the array. You can loop in through each object in the array. The test that I have performed is using JSON object. You can also create the JSON object rather than an array when you reading the csv content.

Once I have the JSON object now I am using Foreach loop to loop through each JSON value. Inside the foreach loop, you can use Insert Entity action to insert one JSON value at a time to your storage table as per your requirement. The Insert Entity action accepts the JSON value as below.

Note: You need to define PartitionKey and RowKey whenever you are inserting the data to storage tables


89476-image.png

Hope the above helps. Feel free to get back to me if you need any assistance.

Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


image.png (17.9 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MayankBargali-MSFT

Thank you very much for your answer. Could you explain how to use a JSON object to read the csv file instead of an array please?

0 Votes 0 ·

@Tanvi-6143 Please refer to the previous discussion to convert CSV to JSON. In the script I have hardcoded the CSV content but you can pass the dynamic content as per the response from Get blob content using path or Get blob content action in your logic app.

0 Votes 0 ·