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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Create an excel file o...
Power Automate
Suggested Answer

Create an excel file on a SharePoint Site and email it based Power Apps trigger

(2) ShareShare
ReportReport
Posted on by 1,145
Hi Guys,
 
I am going to be honest that I have been using Copilot to do this and stuck at a part that I am not confident Copilot know what it is doing :)
 
I am trying to create an excel file on a SharePoint Site and email it based Power Apps trigger, below is the flow I have so far.
 
All help greatly appreciated 
 
 
if(empty(triggerBody()?['date']), '', formatDateTime(triggerBody()?['date'], 'yyyy-MM-dd', 'en-GB'))
 
 
outputs('Compose_–_ISO_FromDate')
 
 
I have the same question (0)
  • Suggested answer
    SpongYe Profile Picture
    5,883 Super User 2026 Season 1 on at
    Hi @jbrines
     
    You’re very close, but the main issue is the Create file step. In Power Automate, you cannot create a valid .xlsx file by putting SharePoint list column values directly into File Content. An Excel file needs real workbook content, for example the usual approach is to use an existing Excel template that already contains a table, then create/copy a new file from that template and use Add a row into a table to populate it.
     
    This guide by Matthew Devaney shows the common Power Automate pattern for creating an Excel file and adding rows to it dynamically.
     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    SpongYe Power Platform Enthusiast [LinkedIn] | [Youtube| [My blog]

     

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my blog [@SpongYe] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • jbrines Profile Picture
    1,145 on at
    Hi @SpongYe
     
    I created the flow I need but how do I get it to use the Power Apps inputs as I am only wanting excel data from those inputs
     
     
  • Suggested answer
    SpongYe Profile Picture
    5,883 Super User 2026 Season 1 on at
    Hi @jbrines,

    Yes, you can use the Power Apps inputs as parameters for the flow.
    In your case, the Power Apps inputs should mainly be used in the Get items filter, so the Excel file only includes the SharePoint records matching what the user entered in Power Apps.
     
    You need to change these parameters and replace Test with the Powerapps input.

    For example, if Power Apps passes in Description and Date, use those values in Get items:


  • jbrines Profile Picture
    1,145 on at
    Hi @SpongYe
     
    Thanks for the above.
     
    I am now getting the following error when testing the flow.
     
    Action 'Create_table:_AttendeesTable' failed
    
    The request is forbidden by Graph API. Error code is 'AccessDenied'. Error message is 'Could not obtain a WAC access token.'.
    clientRequestId: 13242047-1f01-40ed-8978-676a9d526967
    serviceRequestId: 761730d9-b9de-4805-9064-9b1b2c73b4d7
    What could the issue be
  • jbrines Profile Picture
    1,145 on at
    Hi @SpongYe
     
    It appears t be creating files but not CSV or XLSX ones
     
  • Suggested answer
    SpongYe Profile Picture
    5,883 Super User 2026 Season 1 on at
    Hi @jbrines,

    From the screenshot, it looks like the files are being created without a file extension.
    For Excel, the file name must end in .xlsx. For example, in the Create file action, use an expression like:
    concat('Attendees_', formatDateTime(utcNow(),'yyyy-MM-dd_HHmmss'), '.xlsx')
    At the moment it looks like the flow is creating files named something like:
    Attendees_2026-06-04_012117
    but it should be:
    Attendees_2026-06-04_012117.xlsx
    Also, make sure the File Content is coming from a real Excel template file.
    Adding .xlsx to the name alone is not enough if the content is not valid Excel workbook content.

     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    SpongYe Power Platform Enthusiast [LinkedIn] | [Youtube| [My blog]

     

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my blog [@SpongYe] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • jbrines Profile Picture
    1,145 on at
    Fixed the issue with not being an XLSX file as I hadn't added the .xlsx extension to the end of the compose.
     
    Now the excel file has no data it it except a table with one header called Column1
     
  • Suggested answer
    SpongYe Profile Picture
    5,883 Super User 2026 Season 1 on at
     
    One option that may be simpler is to use Copy file action instead of creating the Excel file.
    Create one Excel template file in SharePoint with the correct table and headers already set up.
     
    Then in the flow, use SharePoint Copy file to copy that template into the output folder with a new name, for example:
    concat('Attendees_', formatDateTime(utcNow(),'yyyy-MM-dd_HHmmss'), '.xlsx')
    After that, use Add a row into a table against the copied file.
     
    That way, the new file already has the correct Excel structure, headers, and table name, and you can skip the Create table step entirely.  
      
          Microsoft reference for the SharePoint Copy file action  https://learn.microsoft.com/en-us/connectors/sharepointonline/#copy-file   
     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    SpongYe Power Platform Enthusiast [LinkedIn] | [Youtube| [My blog]

     

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my blog [@SpongYe] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

     
  • jbrines Profile Picture
    1,145 on at
    Hi @SpongYe
     
    I have fixed the filename issue.
     
    The reason for the spreadsheet not having headings on the table is down to the Odata filter, I have removed the filter for now as I want to get the flow working.
     
    Issue now is the "Add a row into a table: Export To Excel Data Row" isn't working 
     
    Gives this error 
     
    A value must be provided for item.
    clientRequestId: 968d7694-6608-4e42-8cba-4563a186b0a2
  • SpongYe Profile Picture
    5,883 Super User 2026 Season 1 on at
     
    Could you share a few screenshots of the current setup? Since a few things have changed, it would help to see the latest flow configuration, especially around the Apply to each and Add a row into a table steps.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 470

#2
Haque Profile Picture

Haque 416

#3
David_MA Profile Picture

David_MA 344 Super User 2026 Season 1

Last 30 days Overall leaderboard