cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Combining multiple & identical tables from different workbooks into one table in another workbook (Excel Online & SharePoint)

I have 12 tables across 12 diffrent workbooks, whereby 12 indivdual users will be populating daily via excel online. I would like all these tables appending into 1 table, which is in a differnt workbook (on a daily basis) 

 

The files are all on SharePoint, in a document libary. 

 

Using power automate, I know how to "list rows present in table" and "add a row" to another table, but I would like it to be dynamic  saving me creating 12 indivdual flows. The users will be using the excel online documents, therefore Power Query isn't an option on this occasion.

 

I feel like I am very close, but just can't quite get the dynamic piece right! 

 

Thank you in advance 

@grantjenkins 

1 ACCEPTED SOLUTION

Accepted Solutions

Hopefully this gets closer 🙂. This assumes your daily Excel files only contain the data from that day. If the individual Excel files contain appended data (multiple days), then we can still get what you're after - let me know.

 

In this example, there is an Excel file called Combined_Tracker.xlsx that will contain the combined data.

grantjenkins_0-1671670069297.png

 

The Combined_Tracker Excel File has the same Table structure as the other files.

grantjenkins_7-1671670559579.png

 

 

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

grantjenkins_1-1671670099631.png

 

Get files retrieves all the Excel files in the Tracker/Files folder.

grantjenkins_2-1671670202902.png

 

Apply to each table iterates over each of the files returned from Get files.

grantjenkins_3-1671670250584.png

 

List rows present in a table retrieves the rows from the TrackerTable from the current file.

grantjenkins_4-1671670287574.png

 

Apply to each row iterates over each of the rows.

grantjenkins_5-1671670332268.png

 

Add a row into a table adds each of the rows to the Combined_Tracker Excel file. The expressions used in this example are below:

items('Apply_to_each_row')?['Technician']
items('Apply_to_each_row')?['Work Allocation']
items('Apply_to_each_row')?['Daily Contracted']
items('Apply_to_each_row')?['Holiday Planned']

//To get your fields you would use the following:
items('Apply_to_each_row')?['YOUR_FIELD_NAME']

grantjenkins_6-1671670398718.png

 

The result after running the flow.

grantjenkins_8-1671672142311.png

 


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

View solution in original post

13 REPLIES 13

Sorry, I didn't mention - there are 4 tables in each workbook (of the 12) so I may need to use the Filter Operation? 

A few questions:

  1. Will all the Tables have the same column headers?
  2. Will all the Tables be named the same?
  3. Will all the Tables be in the same worksheet across the workbooks (for example, will they all be in Sheet1)?
  4. Are you able to show one of the Tables to see what sort of data is stored in them?
  5. Are all the workbooks in the same library/folder?
  6. Are there other workbooks with the 12 you want to use? (Just wondering how you will know exactly which workbooks to use).

----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

Hi @grantjenkins thank you for the reply. 
There are just 12 files in a folder, that are all identical in everyway apart from the file title, and the table names. The headers are titled identical in each of the 12 tables required, and the data going into them is all numbers (which will vary depending on the input) 

For example: 

File Name: Daves Tracker      Table Example 1: Dave_Tracker   
File Name: Johns Tracker      Table Example 2: John_Tracker 

And so on... all (although within the workbooks (all 12), on different sheets there are other tables which can be ignored. 

 

I could re-title the tables to be identical if that makes it all a bit easier.?

Are you able to show one of the Tables including the headers? Also, if it's all numbers, how will you know what person's data it is when it's combined into a single Table?


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

See below example.

There are 53 colunms, so maybe too large for here. The only section that is text will be the technicians name, and work type althoigh this is pre-populated via a cell reference and the rest of the table gathers / references data based on a number of inputs within the rest of the excel sheet. (that the users complete daily) 

I've got a solution that combines workbook tables into a single CSV file. If you wanted it to be an Excel file instead then let me know. Also, if this isn't exactly what you were after then let me know and I can change it.

 

Note that I've assumed the Table names are all named TrackerTable which makes it much easier to retrieve the correct tables within each workbook.

 

For this example, I have a folder called Trackers that will contain the daily CSV with the combined data, and a folder called Files that will contain all the Excel files we need to combine.

grantjenkins_0-1671631225394.png

 

grantjenkins_1-1671631256391.png

 

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

grantjenkins_2-1671631334355.png

 

Recurrence is set to run daily.

grantjenkins_3-1671631366544.png

 

Get files returns all files within the Tracker/Files folder.

grantjenkins_4-1671631421060.png

 

Initialize variable rows creates an array variable called rows which is set to an empty array. This will be used to hold our combined data.

grantjenkins_5-1671631460044.png

 

Apply to each iterates over each of the files returned from Get files.

grantjenkins_6-1671631554468.png

 

List rows present in a table will get all the rows from the current workbook using Full Path for the File and TrackerTable for the Table.

grantjenkins_7-1671631646221.png

 

Compose uses a union expression to combine the data returned with the data in our rows variable. The expression used is:

union(variables('rows'), outputs('List_rows_present_in_a_table')?['body/value'])

grantjenkins_8-1671631780543.png

 

Set variable rows then sets our rows variable to the combined data.

grantjenkins_9-1671631821303.png

 

Create CSV table takes in the rows variable that contains all our combined data and maps the fields we want in the CSV. The expressions used in my example are:

item()?['Technician']
item()?['Work Allocation']
item()?['Daily Contracted']
item()?['Holiday Planned']

//To get your fields you would use the following:
item()?['YOUR_FIELD_NAME']

grantjenkins_10-1671631897720.png

 

Finally, Create file used the output from Create CSV table to create a new CSV file. It uses the current date as the filename using the following expression, followed by .csv

formatDateTime(utcNow(), 'yyyy-MM-dd')

grantjenkins_11-1671632166027.png

 

This should give you a CSV file with the combined output. As mentioned, if this isn't what you were after, please let me know.

 


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

This is incredibly detailed, and I cant thank you enough. I will take your advice on this, but I was hoping for the daily data to end up in an excel table, with each subsequent day being added to the bottom of it. Is that much of a difference ? Happy to rename the tables still. OR would you advise I create CSVs for each day? 

 

Thank you again - this is real helpful. 

Hopefully this gets closer 🙂. This assumes your daily Excel files only contain the data from that day. If the individual Excel files contain appended data (multiple days), then we can still get what you're after - let me know.

 

In this example, there is an Excel file called Combined_Tracker.xlsx that will contain the combined data.

grantjenkins_0-1671670069297.png

 

The Combined_Tracker Excel File has the same Table structure as the other files.

grantjenkins_7-1671670559579.png

 

 

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

grantjenkins_1-1671670099631.png

 

Get files retrieves all the Excel files in the Tracker/Files folder.

grantjenkins_2-1671670202902.png

 

Apply to each table iterates over each of the files returned from Get files.

grantjenkins_3-1671670250584.png

 

List rows present in a table retrieves the rows from the TrackerTable from the current file.

grantjenkins_4-1671670287574.png

 

Apply to each row iterates over each of the rows.

grantjenkins_5-1671670332268.png

 

Add a row into a table adds each of the rows to the Combined_Tracker Excel file. The expressions used in this example are below:

items('Apply_to_each_row')?['Technician']
items('Apply_to_each_row')?['Work Allocation']
items('Apply_to_each_row')?['Daily Contracted']
items('Apply_to_each_row')?['Holiday Planned']

//To get your fields you would use the following:
items('Apply_to_each_row')?['YOUR_FIELD_NAME']

grantjenkins_6-1671670398718.png

 

The result after running the flow.

grantjenkins_8-1671672142311.png

 


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

Sorry for late reply, I will put this together over the holiday period and report back. It looks like it’s going to be perfect though. This is similar to what I had, but I was just missing the expressions piece as I don’t understand them. 

Thank you very much, you have been ace! 

Hi Greg, 

 

So I put together the flow as outlined above, and tested at each stage to ensure I was on the right track, although as soon as I added in an expression it failed to save. Is this because I have to add an expression for each colunm? 

 

I have re-titled all the tables so they are identical - event the combined table.

Aswift2022__0-1671827455706.png

 

Apoligies - I hadnt re-titled the "Apply to each" control to "Apply to each row" - I have now and the flow is running and can confirm it works!! 

 

Thank you - I really appreciate your help - Merry Christmas! 

Hi I keep having trouble with this flow - could someone help? specifically when i try to use the full path dynamic in list rows present, the Table field wont allow me to pick Table1. "I get the following error: Could not retrieve values. Value segment type 'literal' expression '' invalid. Only literal segment types may be used."

 

I have tried to first link to one of the files in the folder, and then can get Table 1 for Table field. Then i would remove the direct file path and put full path for dynamic path. But then the table changes from Table 1 to a serial number.

 

in my scenario for testing - i have two excel files (with multiple tables and worksheets) in a sharepoint in the same folder.  i need to daily consolidate only Table 1 from each of these files into a master file on the sharepoint. i made sure the table i need is labeled Table1.

 

 

Bringing this topic back up. I tried this out because I have the exact same situation. Except only one sheet per file. But when I tried this out my master file started populating blank rows.

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (3,638)