web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to create a flow t...
Power Automate
Unanswered

How to create a flow to "delete a row" once a copy download is performed.

(1) ShareShare
ReportReport
Posted on by 28
I have created a flow within Power Automate that deletes all rows in a an excel file located in a sharepoint location. I have done this by using the trigger When a file is created or modified (properties only).  The process is when a microsoft form is completed, this triggers a flow to add the details of that form to a row in an excel spreadsheet. I then want to be able to create a copy of the file and when that is done for another flow / trigger to delete all rows in the online original file.
 
At the moment I have it that as soon as the form is completed and a row added to the excel file, the rows are deleted instantly as I have the trigger slightly wrong . What I need is for my trigger to run once a copy download is made of the file and not when modification are being made. Is this possible?
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    Apologies as I could just be confused here.
     
    You said
    The process is when a microsoft form is completed, this triggers a flow to add the details of that form to a row in an excel spreadsheet. I then want to be able to create a copy of the file and when that is done for another flow / trigger to delete all rows in the online original file.
     
    What does "I Then want" mean. As in, when is when? An hour later, immediately after you add the row?
     
    So every single time a Form is submitted you want the file copied?
     
    Curious why don't you just put the data in the location you want it, versus adding it to Excel, then copying the rows to another file somewhere else, then removing lines?
     
    When you say you want it when you do a Copy Download. Is that done manually or via some flow or App?
     
    If it's done manually, then you would have to create another flow.
    in that flow, you would trigger when a file is created
    Assuming you are using the same file name OR can parse the original file name from the new name OR you have it in an environment variable or other configuration, then you would use this trigger, to go back to the original file and remove the rows.
     
    If I can make a recommendation though.
     
    In the original file you should have a DateTime Stamp and only remove lines that are before the File Download or you might remove new lines that are generated in between the file download and the original file update.
     
    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.
    Thank you!
    Sincerely, Michael Gernaey
  • Suggested answer
    Tomac Profile Picture
    3,948 Moderator on at
    It looks like you're using two flows to do this, but I think you only want to use one:
     
    This flow will trigger when somebody responds, get the response details, fill those details into a second spreadsheet, then find the rows in the Forms spreadsheet and use those Row IDs to delete those rows.
     
    Should be what you're looking for.
     
    If this resolves your issue, please mark it as the answer.
  • LB-23071237-0 Profile Picture
    28 on at
    Thank you both for your responses. My apologies for not being clear enough. Ill explain now what I am trying to do in a little more detail
     
    Scenario: I am trying to create a Microsoft group form for attendees at a work lunch meeting to complete (I have created the form). I then require each individual response / submission to add a row, with the response details to a predefined excel spreadsheet stored in a TEAMS shared location (online). The purpose of this task is to allow members of our teams to submit their expense reports, and use this excel file to import the attendees at the lunch meeting into a web based expense system called concur.
     
    I have already successfully created one flow which will add a row with the response details to the spreadsheet.. Prior to a colleague importing the form into our web based concur system, they will first need to download a copy locally as Concur does not like imports from other web based locations. What I am trying to do and where I am stuck is editing the first flow or creating a second flow, that creates an action whereby once a copy download is made of the web based file in the TEAMS/SharePoint location, the flow will automatically delete all the rows in the original file, leaving it clean and tidy for the next meeting.
  • Suggested answer
    Power Platform 1919 Profile Picture
    1,890 on at

    Hi ,

     

    I’d start by copying the Excel file to a different location before you clear out the original. In practice as suggested by , insert a Create file action (SharePoint or OneDrive) immediately after your Add a row into a table step. Once that copy succeeds - and after a brief Delay to ensure everything’s synced you can safely delete all rows in the main file.

     

    Quick question: how are you handling concurrent submissions in this scenario? If two people submit at nearly the same time, the file becomes locked or might rows get deleted before everything’s written?

    My suggestion +  :
    1. Add a timestamp column

    In your Excel table, add a SubmissionTime DateTime column. When your form-triggered flow uses Add a row into a table, set this to utcNow() so every record carries its submission timestamp.
     

    2.Build a scheduled flow

    • Trigger: Recurrence → every day at, say, 2 AM.

    • List rows present in a table: point to your main workbook/table. with filter condition to get only past 1 day records .

    • Save those records to different file or csv file with create csv table action and save it in different location.

    • After the file is created use the results from List rows present in a table with filters, and do apply to each loop with delete a row action.

    ​​​​​​​

    Why this helps

    • You archive each day’s submissions into its own file for reliable downstream processing.

    • Deletion runs once daily and only removes records older than 24 hours, avoiding locks or race conditions in your form-triggered flow.

    • Your main Excel stays clean, and your processing flows always point at a static, date-stamped file so there’s no conflict when new submissions arrive.

    Please give the mentioned solution a try and let me know whether it works for you.
    If it solves your issue, feel free to mark this thread as answered.
    Please make sure to like the response!
    Thanks!
    - Hemanth Sai

  • Suggested answer
    Tomac Profile Picture
    3,948 Moderator on at
    @LB-23071237-0 To answer the question I think you're asking, no there is no trigger in Power Automate that will activate a flow when a file is downloaded or a copy of a file is downloaded. You'll need to use other trigger conditions as noted in the comments below to accomplish your goal.
     
    Using the suggestion from @Power Apps 1919 you can add Get File Contents and Create File actions at the end and fill it with the content of your Excel document to have a downloaded (to OneDrive, and if roaming profiles are set up, to that specific user's Documents or Desktop folders) copy of the previous day's responses ready first thing in the morning.
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
    Lol @Tomac exactly what you said brother... its all just stuff from CoPilot or Chat GPT.
     
     
    Here is what you would do if you want it to work how you asked.
     
    1. Create your Excel file that is fine with your current flow
     
    2. You have to create another Flow that will monitor the Back end of Teams, which is not an issue as its really just onedrive/sharepoint anyway.
    --You can setup another flow either in Teams itself, or outside doesn't matter.
    --When the other person Copies the file, you will Trigger on the File Create there
    --Then process the file. As I mentioned before, as long as you have Environment variables, or configuration that the second flow can use to find the original file location (the file name will be the same as the copied file I am assuming). Then you can use the When a file is created trigger still for the second flow.
     
    That will give you exactly what you asked for based on your clearer explanation.
     
    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.
    Thank you!
    Sincerely, Michael Gernaey
     
     
     
  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    Do any of the answers help you or do you need further assistance?
     
    Cheers
  • LB-23071237-0 Profile Picture
    28 on at
    Thank you all for your super helpful input, just havent had the time yet to work through the suggested solutions. The problem I am having now is when I use the Create File sharepoint connector the file is created but I received the attached error when trying to open it. Have you seen this before?
     
  • Power Platform 1919 Profile Picture
    1,890 on at
    Hi @LB-23071237-0, can you please share the screenshot of the create file action and it's corresponding  actions, so we can solve it together 
  • LB-23071237-0 Profile Picture
    28 on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard