I'm new with Power Automate and I'm trying to combine existing Excel files stored in Sharepoint folder (eg folder "data" in my Document library) in a single one (such as an Excel master file). The trigger is either when a new Excel file is uploaded to Sharepoint or an existing one is modified. All files have the same structure (eg column's name), the only thing is the headers start at row 10
-
I would use a Power Query to do the combining. Use Power Automate to trigger the refresh. In the meantime you might like to edit your post to actually include a questionCHill60– CHill602024-09-04 13:21:42 +00:00Commented Sep 4, 2024 at 13:21
-
Office =Scripts will do it for you, or just use the built in operations for Excel IF you're using tables.Skin– Skin2024-09-08 11:39:00 +00:00Commented Sep 8, 2024 at 11:39
-
Thank you @CHill60 and Skin for your reply. I know that it could accomplish within PowerBI or using scripts but in my case the name of Excel files pushed to the Sharepoint folder change over time. Indeed, I have for example in my Sharepoint folder 5 Excel files and I can merged all together in one master file (new Excel file). How can I add additional rows from new incoming Excel files in the Sharepoint folder to my master file. In Power Automate you can trigger an action respecting a modification or when a new file is added to the Sharepoint folder but I don't know how to implement it.EricP– EricP2024-09-09 07:34:00 +00:00Commented Sep 9, 2024 at 7:34
1 Answer
Posting as a solution as I'm running out of characters in the comments.
Firsly, I suggested Power Query not Power BI.
It is a simple matter to get it to read all the files in a folder, regardless of naming conventions, and merge them into a single worksheet.
Each time it runs it will pick up any new files and the data in them. So consider housekeeping over time and "age" of data.
You can have the queries refresh when you open the master file, but it might be better to have some VBA in Workbook_Open() that refreshes the query then saves the workbook. You must have 'Run as Background Query' turned off if using Power Queries in VBA. This is to ensure that control only returns to VBA when the query has completely finished. The same might be true of Office Scripts.
There are plenty of resources across the Internet that will give you a step-by-step guide to implementating an action via Power Automate when a new file is added to a folder. See this for example: https://manueltgomes.com/microsoft/how-to-update-sharepoint-with-excel-files-in-a-folder/
