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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Saving SQL query results to csv on sharepoint

(0) ShareShare
ReportReport
Posted on by 74

I am new to MS Flow. I am trying to schedule a flow that will each time save the results of the SQL query to csv or excel, under same name. 

I hoped this would be simple with Flow but it's fairly complicated. If I understood correctly I can't just do this in 3 steps, start->query->Save, I need to do it for each item in the results. Below is my poor attempt , just saves the last item I guess. 

Also, when I resolve this, do I need add a step to delete the file and create new one with the same name of will the flow overwrite the file?

 

7A753EC8.png

 

 

 

I have the same question (0)
  • Verified answer
    v-duann-msft Profile Picture
    on at
    Re: Saving SQL query results to csv on sharepoint

    Hi @Krcmjaster 

     

    Thank you very much for posting.

     

    According to your query, you would like to export data from SQL and export to a CSV file in SharePoint. If that’s the case, we can combine ‘create CSV table ’ with ‘create file’ to achieve your purpose.

     

    The whole flow may look like as below:

    v-duann-msft_0-1612507144605.png

     

     

    You could refer below articles to create CSV table:

    https://flow.microsoft.com/en-us/blog/html-tables-csvs-computer-vision/

    https://us.flow.microsoft.com/en-us/galleries/public/templates/79095f001ee911e79dc3835964ea3218/copy-sharepoint-list-items-into-a-csv-each-week/

     

    Yes, we will encounter duplicate issue if file with same name created. Thus, I recommend we can use a dynamic content [‘utcnow().csv’ something like that] as filename for easily distinguishing which is the updated one.

     

    Hope it helps.

     

    Thanks

    Anna

  • Krcmjaster Profile Picture
    74 on at
    Re: Saving SQL query results to csv on sharepoint

    @v-duann-msft Thanks, this helped 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 722 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 461 Moderator

#3
developerAJ Profile Picture

developerAJ 283

Last 30 days Overall leaderboard