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

Combining multiple Excels in Sharepoint into a single Excel file

I have a bunch of Excels that have identical tables (with different contents of course). I want to combine these Excels into one single Excel which has the exact same type of table as the other ones.

 

The flow below doesn't work, I think I'm not using the correct Sharepoint fields for the list rows action.

 

Can anyone help me on my way?

 

tomswaelen_0-1678461604211.png

 

19 REPLIES 19

For your List rows present in a table, you should use the drop-down to select the Location (SharePoint Site) and Document Library. They should both be the same as what you used in Get files (properties only).

 

For File you should be using the Full Path property.

 

grantjenkins_0-1678493969192.png

 

How are you thinking of combined the Excel files? Are you going to extract all the data across these Excel files and output to a completely new Excel file that you have? Or are you using one of the existing Excel files and appending to it?

 

Also, how many items across all Excel files would you have (approximately)?


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

@grantjenkins I'm thinking of combining all the Excel files in a Sharepoint location into one aggregation file. So not into one of the 'original' files. However, the aggregation Excel is identical to the original files; the only difference is that it should have all the data of the other files in it. After running the flow, the original files should be moved to a new (Archive) location in Sharepoint.

 

I'm thinking of running this flow every hour or so, so it should never be more than a 20-30 Excel files at a time, maximum.

 

Is this something that can be done with Power Automate Cloud?

This is the flow I have at the moment, but even without the step to add the content of the single Excel files into the combination Excel, the flow fails.

 

Am I doing something wrong or is this just not possible with PA Cloud?

 

tomswaelen_0-1678791726478.png

 

Another way to do this, would be to read the contents of Excel attachments and add the content of the table (always the same name) in those attachments to an aggregation Excel on Sharepoint. I have scoured the internet, but I cannot find a cloud flow that would easily do this.

 

The list rows action asks me for a Sharepoint address, but I need this to be the attachment of the e-mail.

Just to confirm - is you trigger going to be when a new email arrives with attachments. And you need to get the data from those attachments (Excel files) an combine them into a new Excel file? I didn't realize they were coming as attachments in an email before. If you can confirm, then I'll try to write up a complete solution tomorrow (1AM where I am at the moment - so off to sleep now).


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

@grantjenkins  combining Excels on Sharepoint was actually a workaround I had been thinking about, so yes, the original idea was this:

 

1. E-mail arrives in a shared mailbox

2. E-mail contains an XLSX or XLSM attachment, which contains a table with always the same name and same columns

3. The contents of the table in this attachment are read and added to an Excel Online file which contains a table with the same columns as the attachments.

4. The e-mail is moved to a 'Processed' folder (I can probably figure this one out myself 😉 )

 

 

Another workaround is to have the e-mail body contain the necessary data instead of the attachment, but there are plenty of resources on the internet that explain how to do this.

Hopefully this is what you're looking for. Note that I've got the trigger on my own mailbox as I don't have a Shared mailbox setup. It will save each of the attachments temporarily, retrieve the data, then delete them.

 

For this example, I've got a folder called Processing within my Documents Library. And within there I have my main Excel file that will get added to over time. It has a Table called Table1 with Name and Age headers.

 

grantjenkins_0-1679212335010.png

 

grantjenkins_1-1679212377144.png

 

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

grantjenkins_2-1679212541329.png

 

When a new email arrives will trigger the flow when an email arrives with attachments. I've also set the Subject Filter to only pick up emails with a Subject of 'Processing" - you would have whatever you wanted here.

grantjenkins_3-1679212619083.png

 

For the trigger (above) I've also set Concurrency Control to On and set the Degree of Parallelism to 1. This is so that the flow won't run in parallel if we have multiple emails coming in at the same time. It will wait for the running flow to complete, then start the next one.

grantjenkins_11-1679213387807.png

 

grantjenkins_12-1679213395527.png

 

Apply to each attachment will iterate over each of the attachments.

grantjenkins_4-1679212650948.png

 

Create file will use the content from the attachment and create a temporary file within our Processing folder. I've used the following expression to ensure we always get a unique name, so we don't get into conflicts.

concat(
  guid(), 
  '.', 
  slice(items('Apply_to_each_attachment')?['name'], lastIndexOf(items('Apply_to_each_attachment')?['name'], '.'))
)

grantjenkins_5-1679212773205.png

 

List rows present in a table retrieves the rows from the file we just created. Note that I've manually typed Table1 assuming the table names will always be the same.

grantjenkins_6-1679212834723.png

 

Apply to each row iterates over each of the rows returned, and uses Add a row into a table to add each row into the master (Main.xlsx) file.

grantjenkins_7-1679212886927.png

 

Delete item deletes the file that was created (our attachment). Note that I manually typed Documents since it only shows Lists (not Libraries) in the dynamic data.

grantjenkins_8-1679212964135.png

 

 

For testing purposes, I've attached two .xlsx files and one .xlsm files, each with two rows of data.

grantjenkins_9-1679213115590.png

 

And the output in our Main.xslx file.

grantjenkins_10-1679213236104.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.

Hi @grantjenkins ,

 

I've tried replicating this flow, and testing it up until the get rows action, but the flow times out on the apply to each. The trigger works.

 

Also, in the add rows-step, how do you get the Excel field names in Power Automate? I don't understand as at that time, the flow does not know those names in edit mode?

 

tomswaelen_0-1679221965386.png

 

Using the Test Flow with this type of trigger can be a bit inconsistent (the attachment content can get corrupted).

 

It's best to send an email each time with attachments and let the flow run, then go into the Flow run itself. to see how it went For testing purposes, I just kept forwarding the email to myself, so it kept the attachments.


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

@grantjenkins  OK, I'll try again.

 

But I also do not understand the 'Add row' step. How do you get the field names of the Excel attachment in the dynamic content window? I don't have those. (which seems logical to me, because the field names are 'theoretical' or 'virtual' at that point, the flow does not know these field names)

Ah sorry - because we type in the Table name manually, Power Automate can't infer the column names. In order to get what you need; you would use the following expressions.

 

item()?['Name']
item()?['Age']

//Format
item()?['Name of your header in Excel']

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

@grantjenkins  That seems to work, thank you 🙂

 

One final question, I'd like to move the created file to a separate folder, but I'm unsure how to call the file that has to be moved in the Sharepoint Move File action. 'Name' does not seem to be correct:

 

tomswaelen_0-1679309978927.png

 

Perhaps Path? Or Path/Name?

I'm not sure what you mean by created file? Do you mean the attachments that are temporarily created and then deleted?


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

Yes, so instead of deleting the file, I'd like to move it to a Processed folder, but I'm unsure on how to call the file that was created in the previous step. 'Name' doesn't seem to work.

I think it would be the Identifier field from Create file.


----------------------------------------------------------------------
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,

 

No, tried that. The flow runs up until the 'Move file' step, where it fails.

What is the error message you get?


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

Apparently, the syntax in the action is correct; I get this error message:

 

File 'Shared Documents/******************/3d3452d3-2e4a-4f23-a2f3-15157c92f162..xlsx' cannot be moved because it is in locked mode.
clientRequestId: bc122430-8c70-4d9d-8589-077661b1ff0b
serviceRequestId: bc122430-8c70-4d9d-8589-077661b1ff0b

@tomswaelen did you end up getting this to work? Trying to achieve the same thing and not having any luck.

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 (1,234)