Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Dynamic Table Range in Excel Online "Create Table" node



Every day, we save an Excel file on our Sharepoint environment and create an Excel Table in the file. 

The content of the Excel file is different every day. Different number of rows as well.


When I use the "Create Table" node from the Excel Online package, I need to specify the Table Range.

Every file contains columns A to column DN. But the rows are different. 

It tried the table Range "A:DN" but when I do that, it creates a lot of empty rows at the end of the data table. So I think I have to specify the number of rows as well.


For example today I have 412 rows. So the table range is "A$1:DN$412". 


My question is: Do I really need to specify the number of rows in the table range? and if so: How can I extract the number of rows from an Excel file?





Community Support
Community Support

Hi @MarcoS ,


You need to specify the number of rows in the table range and however, there is no any way to extract the number of rows from an Excel file currently.


Best regards,



Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Memorable Member
Memorable Member

Hi @MarcoS 


Yes, you need to set the range.


You can measure the rows with a expression inside a compose:

The expression is 




You need to change the red text to your action name, like the print below:


Best Regards

Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!



In your example you first use the node 'List rows present in a table' and then use a compose node to extract the number of rows. 

But in the node 'List rows present in table' you have to select the table inside the Excel file. But I don't have a table, because I first need the number of rows to create it.



Memorable Member
Memorable Member

Hi @MarcoS 


Sorry for my wrongly understood.


I think this article can help you:


Count on me for what you need

Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!

Frequent Visitor

Hi @MarcoS  do you have already your issue with dynamic table range ?

MS FLOW Excel Online 'Create a table' dynamic table range


Hey Guys,

This one has been bugging me. I'm a python programmer, trying to help someone move and parse files in MS Teams, so some of things I see in MS FLOW are just weird, and really get away from the whole point of giving business users the ability to create a FLOW with minimal to zero "coding". I'm sure there are some that have the ability, inclination and TIME to create FLOWS, but from what I've seen and the business people I have talked to that are really good working in excel formulas, they find getting FLOWS to work fairly difficult. Needless to say, once again, MS is about Marketing and not about making it easy and making users happy.


FLOW I was asked to help create;

Take an email with some .xlsx attachments.

Go thru each attachment;

    Pull out the rows from each.

    Append each row to the proper main spreadsheet ( there are three of them, and which one you append the rows to, depends on which client they are associated with).


1. Starting the email trigger was easy, no sweat.

2. Saving the attachment spreadsheets was ok, but I did learn that you mostly need to set up a "Do until" action, to wait for the spreadsheet to be created or really, saved inside Sharepoint, before I can pull the rows from it. It can take any where from 20 seconds to 1 minute for it to be saved.

3. Now here is where it gets tricky. I just want to go into the spreadsheet I just saved from the "Create file" Action and get the rows from "Sheet1", starting in cell "A1". There used to be a "Get rows" feature that, from what I read, was pretty easy to use, but they took that away.  Now, In order to get rows from a spreadsheet, you need to have the data thats in the spreadsheet exist inside of a "Table".  But, the .xlsx files I get as attachments are from a 3rd party and the data is not inside of a "Table", and I think this is the same for alot of people. So after you save your spreadsheet to Sharepoint (or One-Drive), which you are forced to do, you need to wrap the existing rows of data inside of a "Table", using the Excel Action "Create Table". Ok Fine. But hold on - and this is what MS Technicians are telling you - you need to explicitly state or in reality HARD-CODE what the exact range is in this Action in order to create the "Table".  But for me, the row range will be different for each spreadhseet coming in. Thankfully, I do know the columns will always be the same - from A to N - however some of the cells/column values will be blank, always. So columns A,B,C I know will always have values, but columns G,H,I will always have blank values (don't ask). Ok so I how do I tell it create a dynamic range for the table no matter how many rows are in a spreadsheet?  I'm glad I asked!!

    1). One power user suggested just setting a row range with a very large value, something over and above what is to be expected. This works really well, you just need a conditional to look for non-blank rows.

    2). You can also use "Office Scripts" to create a Macro, but some folks might not have "AUTOMATE" permissions inside Excel online.

    3). But I kept thinking about the hover instructions inside the "Table range" field in the Action --> "Enter the table address in A1 notation". We know that in Excel there are several ways to create a range, using A1 notation. Why can't we use something like OFFSET combined with SUBTOTAL within this Action? It turns that you can! If someone else has discovered this, I did not find your post and I apologize in advance, I'm not here to rain on your parade, I just want people to know that this exists.  I really want to show this one to everybody, so more information, more better in my view. CAVEAT - But keep in mind - if you have columns that have cells (meaning all cells) that can be blank, YOU CANNOT USE SUBTOTAL within OFFSET to count the columns! It will get the dynamic number of columns wrong, and then push some of the data out of the "Table". Also you can't enter NEW column names in the Action "Column names" field, its only for existing colunm names field... SO if your spreadsheet does not already have a column header row, entering new Column Header Names inside the "Column names" field will overwrite your first row of data!! WHAAAT?!?!.  See below;


I tried to Add Column Header Values "A;B;C;D;E;F;G;H;I;J;K;L;M;N" as you can see in row 1 below, but this overwrote the first row of data, and on top of that, the SUBTOTAL(3,Sheet1!A1:N1) I tried to use within OFFSET to dynamically get the Column count, pushed the last 3 columns of data outside of the table.




In my case I know I will always have columns A thru N. So I created an OFFSET to create the range dynamically (mostly - meaning I know the number of columns, these wont change) and use SUBTOTAL within OFFSET to count the rows of data.


Here is how OFFSET/SUBTOTAL Works;



1. Sheet1!A1 - this is the reference point where we want to start

2. ,0,0 - this says from that reference point above, move down 0 rows and over 0 columns, effectively starting at A1.

3. SUBTOTAL(103,Sheet1!$A:$A) - this represents the number of rows we want in our range base on column A, the "103" tells SUBTOTAL we want a count of the active rows (rows with data) in column A, and informs OFFSET we want the number returned from SUBTOTAL(103,Sheet1!$A:$A) as the number of rows in our range.

4. 14 - these are the number of columns we want in our range - again use we tried to use something like SUBTOTAL(3,Sheet1!A1:N1) to get the column count, but if you don't have Column Headers AND have blank values in some of your columns then this will wreak havoc, and not calculate the Column Range properly.  Hopefully you know the column count like I do.


Thats it, here is a pic;




Hope this helps someone!,





So, again ;), my incoming spreadsheets DO NOT have Column Headers.  My first piece of advice is, for those that have the same situation - if at all possible, have the folks that are creating spreadsheets that you need to get rows from, to just add a Column Header for you.  It will make your life much easier. But for those that are not that fortunate, here are my travails in dealing with not having Column Headers...

When you are working in Excel either standalone or online (not in MS FLOW, but normally), you insert a "Table" in your spreadsheet, there is a checkbox that asks if you if "My table has headers". If you don't check ON this box (see below), it will magically insert headers for you...



Excel "Insert table" with checkbox asking if you have a header.



BEFORE - Raw data before "Insert table", with no header.



AFTER - Table-ized data where it inserts column headers automatically and moves rows down.

But the Excel MS FLOW Action to "Create table" does not incorporate this checkbox or other option to insert a header for you if you don't have one, and move the data rows down. It will either consider the first row of data as the header, or if you enter "Column names" in that field on "Create table" it will replace the current headers you have or overwrite the first data row.


I'm not sure what it would take to incorporate a checkbox that would INSERT a new header row if you don't have one, but this functionality is already in Excel, why is it not here in MS FLOW?

So, here are the hoops I had to jump through and the lessons I learned...

1. I added an action "List rows present in a table".
2. Within the output from "List rows present in a table", the rows are returned in an array with a (I guess) dictionary object contained inside curly braces ( { } ) very much like a json object, with key value pairs separated by a colon, with the key as the column header, and the value as the data values inside the cell. But in this case, the headers are acutally the first row of data, because again, as I've said 10 times already, I DONT HAVE COLUMN HEADERS IN MY SPREADSHEET. This is what it looks like, with the first to elements related to MS FLOW Excel internal tracking, and my elements starting in element 2 (zero based);


Rows array example, which each cell value is a KEY-VALUE pair like "24XTD08521-7004":"24XTD08515-7049" with the KEY(which is the header value, left of the colon ':') is the first row value, and the VALUE is the 2nd row value right of the colon ':'

[{"@odata.etag":"","ItemInternalId":"7a3ca2a2-c6a2-47b2-8cb0-ecdec9f4f856","QUARTZ1":"QUARTZ1","ALEESON VAHN/EDDIOT RANGER":"VAHN/EDDIOT RANGER MANCHEESE","2018-12-05":"2018-12-05","0040701":"0040702","24XTD08521-7004":"24XTD08515-7049","2":"1","Column1":"","QUARTZ COMPANY":"DELIA PACKAGING","80":"40","Column2":"","Column3":"","MF_x003a_ BEST CUDDLING 99EC30N2'S":"NEW 24-XTD85-20","010":"010","24_x002e_00":"24.00"},{"...}]

3. I added an "Apply to each" action, and up at the top of the FLOW I added a variable ("ROW_COUNTER") that will track the number of rows iterating through the apply to each, starting at zero (0).
4. Within the "Apply to each", I added a conditional to check the value of "ROW_COUNTER", and if its 0, i know its the first row, and get the header values from the first row in the array (like above).

NOTE: LESSON LEARNED - MS FLOW will not allow you to iterate through an output array using an index, like outputs('List_rows_present_in_a_table')?[0] - you can ONLY use a string key to get the value, WHY????????? I understand MS FLOW is not supposed to be bound by typical programming language contructs, but come on! Why use variables then, or data types, like array, string, boolean, etc, are they not programming language constructs??????

Because of the nonsense above I had to a) convert the entire array to a string, b) remove the array start and end characters ([ ]), c) split on comma ',' to turn the rows back into an array variable I created. I then take the header values out and put them in a data array and (tried to) assign that array to an array of all the rows. But wait for it...

NOTE: LESSON LEARNED - MS FLOW will not (easily) allow you to add an array to another array. I did find an article that tried to explain how to do it with the "Select" action, but i couldn't get it to work, there is literally a MS FLOW error returned that says you can't add an array to array, only string, boolean, etc, literally any OTHER data type, WHY????????? You couldn't allow one more data type to be added to an array??????

This is so convoluted, but here goes. So eventually I end up with an array of strings, where the strings represent the rows. I add an "Apply to each", and then for each string row I a) split again on comma, ',', so I have an array of each key value pair from the row, then to get the value I want, I can now use an index on the row array (variables('ROW_DATA')?[0]), I b) and split on colon ':', and if the its the first row, I use conditional and use first with split [ first(split(variables('ROW_DATA')?[0]), ':') ] to get the key on the left side of the colon the value I want from the header, then I come out of the conditional, and just let it run in the "Apply_to_each" action normally, but use last with split [ last(split(variables('ROW_DATA')?[0]), ':') ] then take the value on the right side of the colon to get the normal value I want from the row.


I can't use Azure functions, and I can't use Excel OFFICE SCRIPTS in the "AUTOMATE" tab, everything I do is with the built-in MS FLOW Triggers and Actions, so I am limited in my choices and have to get creative to do what the business needs.

Again, I do realize MS FLOW is for business people and its not supposed to be a programming language, but there are definitely things that are inherent in MS FLOW that programming-ish, and I think MS FLOW is kind of in a situation where it doesn't really know what it wants to be at this point, and has good intentions but then doesn't add things that make sense and make it easier for people, and then of course they tell you to put in a request for a feature if something doesn't work the way (IMHO) it should. The above was very painful, but it works, if you want more detail I can share what the FLOW looks like, and THERE MUST BE a better way...but it works for now.

Thank you so match!
You save a lot of my time 🙂

Agreed with the reply above mine - THANK YOU SO MUCH for this trick, as it saved tons of time for me and solved this 5-month puzzle for me!!! I can finally sleep well now. 😁

Helpful resources

Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (40,236)