I have created .csv file in logic app each time when the flow runs the data must be append to the same .csv

Ananya Dixith 61 Reputation points
2024-02-27T13:02:22.8933333+00:00

Hi, I have created .csv file in logic app, but each time when new item is added it is creating different excel. I need all the data must to append in single excel. for every each run new items will be added, but each time it is creating new .csv We need each time when the item is created it should add in to same excel. Pls let me know whether it is possible to append data to same excel. Kindly help me to solve thiscsv action

Screenshot 2024-02-27 130446

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,542 questions
0 comments No comments
{count} votes

Accepted answer
  1. MikeUrnun 9,777 Reputation points Moderator
    2024-02-28T00:59:44.33+00:00

    Hello @Ananya Dixith - Thanks for reaching out, and engaging the MS Q&A community.

    For appending to an existing blob file that's in a .csv format, you can do the following:

    I hope the steps and their corresponding links will help accomplish the task. If you encounter any issues along the way, Feel free to tag me in the comments below.


    Please "Accept Answer" if the answer is helpful so that others in the community may benefit from your experience.


1 additional answer

Sort by: Most helpful
  1. Ananya Dixith 61 Reputation points
    2024-04-02T09:56:39.8333333+00:00

    Hi,

    At first use list blobs, to get the files in the container

    then add the condition to check whether container is empty or not.

    User's image

    If length of the body is equal to zero then the container is empty , it should create new .csv file

    User's image

    If it is empty then it goes to TRUE condition

    1.Create new array variable("newdata") for new data and append to it

    2.create CSV table

    3.create .csv file in container

    User's image

    If the file is already present in the container then false condition,

    1. At first it should get data present in existing .csv file.
    2. Convert .csv file to JSON format
    3. Append the existing data to new array variable.
    4. In compose action join new data("newdata" array variable) and existing ("existingdata" array variable) using "Union"
    5. Create CSV table
    6. Update blob User's image User's image User's image
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.