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 / How to define table ra...
Power Automate
Answered

How to define table range dynamically

(0) ShareShare
ReportReport
Posted on by 19

Hello,

 

I have a flow where i receive an email with an excel and i need to copy the information inside this excel to another workbook. This excel does not have a table, for that reason i need to create a table before to copy the information to the second workbook. The first workbook not always has the same quantity of rows, for that reason i need to create the table range dynamically but i don't know how to do it.

 

I'll appreciate your help.

 

Thanks

Categories:
I have the same question (0)
  • RezaDorrani Profile Picture
    12,145 on at

    Hi @dvega260 

     

    Dynamic table range - https://youtu.be/Kupz71dWYyY

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

    Thanks,
    Reza Dorrani, MVP
    YouTube
    Twitter

  • Verified answer
    jedunn Profile Picture
    123 Microsoft Employee on at

    I think this is a fantastic way to work with dynamic ranges! Very impressive!

     

    Another approach is save the attachment to OneDrive and then run an Office Script to grab the used range. From there you could convert it to a table for processing or use the script to pass the values to your next step.

     

    Here's what the script would look like if you were trying to grab the data: 

     

    function main(workbook: ExcelScript.Workbook)
    {
     // this assumes there is one worksheet with one contiguous range in the workbook
     let dynamicRange = workbook.getFirstWorksheet().getUsedRange();
    
     // you could then grab the values
     let values = dynamicRange.getValues();
    
     // you could convert it to a table
     let newTable = workbook.addTable(dynamicRange.getAddress(),true);
    }

     

     

    You might find some of the Office Scripts samples relevant. There would be a few more lines of code required to pass the values out to the next step in your flow but the samples at the above link should get you started if you want to go that route. Good luck!

  • dvega260 Profile Picture
    19 on at

    Thanks Reza for your help

  • dvega260 Profile Picture
    19 on at

    Thanks Jedunn for your help

  • hitakshi Profile Picture
    162 on at

    Hi @RezaDorrani ,

    This really works but it works only for table rows, not columns. I need both rows and columns. I need to give dynamic values for columns and rows. Please give me a solution.

    Thanks,
    Hitakshi Chauhan   

  • hitakshi Profile Picture
    162 on at

    Hi @RezaDorrani 

    I have 4 multiple files and I have 3 flows that are attached to each other in the first flow we store the file in OneDrive and in the second flow we create a table in this stored file using 'create table' action so we need to give the table range dynamically because we don't know how many columns and rows in these files. How to give dynamic range of the table?

    Please give me a solution immediately.

     

    Thanks,

    Hitakshi Chauhan 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 227

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard