Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 2e6Rlr36dBK9POcMIa6O5L
Power Automate - Building Flows
Answered

Create a table in an Excel workbook in a specific folder

Like (1) ShareShare
ReportReport
Posted on 21 Nov 2023 18:39:26 by 59

We have a folder where an Excel file is dropped in SPO about every two weeks. It has tons of columns and rows, but not in table format. 

I've looked at the Create table action in Power Automate, but it requires a specific file instead of just looking in a folder. Is there dynamic content or an expression that can be used to create the table in a newly created file in the folder without specifying a file name? 

  • takolota1 Profile Picture
    4,859 Super User 2025 Season 1 on 06 Oct 2024 at 23:36:12
    Create a table in an Excel workbook in a specific folder
    You can also use this template Azure Function to pull data from any Excel sheet without the need for table formatting...
    https://community.powerplatform.com/galleries/gallery-posts/?postid=eea06380-8483-ef11-ac21-7c1e5201b42f

    Or if you need something without premium connectors, then you can use these Office Script templates…
  • Verified answer
    grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 22 Nov 2023 at 04:27:29
    Re: Create a table in an Excel workbook in a specific folder

    Below is how I would likely build this.

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_0-1700626592244.png

     

    I would use the trigger When a file is created (properties only) so each time you upload/create a new Excel file it will trigger the flow. In my trigger below it's looking for new files in my Documents library within the folder called Drop Excel Files - so any file created in that folder (including within subfolders) will work.

    grantjenkins_1-1700626983837.png

     

    In addition - I would also add a Trigger Condition to ensure the flow only runs if the file uploaded is an Excel file. To do this, go into Settings then add a Trigger Condition and use the following expression.

    @endsWith(triggerOutputs()?['body/{FilenameWithExtension}'], '.xlsx')

    grantjenkins_2-1700627044289.png

     

    grantjenkins_3-1700627070499.png

     

    For the Table - As long as your Excel file has the table content starting at cell A1 and the first row contains your headers, then this should dynamically select your range of data and use the existing column headers.

    =$A$1:INDEX($1:$1048576,COUNTA($A:$A),COUNTA(1:$1))

    grantjenkins_4-1700627207714.png

  • ScottShearer Profile Picture
    25,223 Most Valuable Professional on 21 Nov 2023 at 19:32:16
    Re: Create a table in an Excel workbook in a specific folder

    @bblande 

    I am familiar with the DoD and these are a different type of script - you might want to try.....

    Another option is for you to rename the files via a Flow when they are uploaded.  This will allow you to specify a specific file in the Create table action.  Then, after the table is created, rename it again to what is was.  If you use this approach, you'll likely need to use a number of pauses or a loop as you will probably see file in use errors.

     

  • bblande Profile Picture
    59 on 21 Nov 2023 at 19:26:17
    Re: Create a table in an Excel workbook in a specific folder

    Yeah I should have mentioned that I'm in a DoD environment and scripts are a no-go around these parts, but thanks.

  • ScottShearer Profile Picture
    25,223 Most Valuable Professional on 21 Nov 2023 at 18:41:52
    Re: Create a table in an Excel workbook in a specific folder

    You probably want to take a look at using Office script to create the table.  The script can be executed from Power Automate when a new item is added to the folder.

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 66 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 65

#3
rzaneti Profile Picture

rzaneti 41 Super User 2025 Season 1

Overall leaderboard