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 / Creating Excel file fr...
Power Automate
Unanswered

Creating Excel file from SQL using Flow but it creates corrupt file in OneDrive

(0) ShareShare
ReportReport
Posted on by 3

Hi, 

 

I am trying to create an One Drive Excel (.xlsx) file from a SQL Server Stored Pro (Running a Select Query). It Creates file successfully but I can't open it because it says that file is possibaly corrupt. However when I try to open it in notepad it looks like that data is there but in Json format:

 

Data displayed in Notepad:

{"Business":"ABC","CreatedOn":"2018-03-01T00:00:00","Product":"XYZ"}

 

Following is my flow:

 

1.jpg

 

Thanks

Categories:
I have the same question (0)
  • v-yuazh-msft Profile Picture
    on at

    Hi @ Hayer,

     

    Do you want to create a excel file with some seleted items when an an item is created in your SQL?

    Or Do you want  to create some excel files with each seleted item when an an item is created in your SQL?

     

     

    If you want to create one or more excel files with seleted items or each seleted item when an an item is created in your SQL,I afraid that there is no way to achieve your needs in Microsoft Flow currently.

     

    Microsoft flow don't support to create a excel file and insert rows in the new excel file in the same flow,if you would like to create a excel file and insert rows in the new excel file in the same flow, please submit an idea to Flow Ideas Forum:

    https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

     

     

     

    Regards,
    Alice Zhang

  • shaan Profile Picture
    3 on at

    Hi @v-yuazh-msft 

     

    Thanks for your reply. I just want to create one excel file from a select statement in stored proc. 

     

    1. A new record in table called 'TriggerFlow' and that insert triggers the flow.

    2. Flow executes a store Proc which contains a single select statement and returns a table.

    3. Apply to each loops through that table to write rows in a newly created file.

     

    Is it something doable or not?

     

    I can create and open a csv file successfully. But when I am trying to create file with .xlsx extention it creates the file but when I try to open it with MS Excel is throws an error saying that file is corrupt. 

     

     

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 398 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 331 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 203 Most Valuable Professional

Last 30 days Overall leaderboard