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 Automate
Unanswered

Combining Excel Files

(0) ShareShare
ReportReport
Posted on by 2

Hello,

 

I have 22 excel worksheets that each have one sheet. I want to move them all to one singular excel workbook just with 22 sheets instead. Then after they are all on the same workbook I want to create another sheet that pulls the first and second column of every sheet and in addition, some random columns depending on what sheet I need more information on. Thanks!

I have the same question (0)
  • CU31080729-3 Profile Picture
    502 Moderator on at

    Hi,

     

    Folder.GetFiles Folder: $'''D:\\Test Folder Output''' FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
    Excel.LaunchExcel.LaunchUnderExistingProcess Visible: True Instance=> ExcelInstance2
    SET Counter TO 1
    LOOP FOREACH CurrentItem2 IN Files
     Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: CurrentItem2 Visible: True ReadOnly: False Instance=> ExcelInstance3
     Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance3 ReadAsText: False FirstLineIsHeader: False RangeValue=> ExcelData
     Excel.AddWorksheet Instance: ExcelInstance2 Name: $'''Data%Counter%''' WorksheetPosition: Excel.WorksheetPosition.Last
     Excel.GetAllWorksheets Instance: ExcelInstance2 Worksheets=> SheetNames
     LOOP FOREACH CurrentItem3 IN SheetNames
     IF CurrentItem3 = $'''Sheet1''' THEN
     Excel.DeleteWorksheet.DeleteWorksheetByName Instance: ExcelInstance2 Name: $'''Sheet1'''
     END
     END
     Excel.WriteToExcel.WriteCell Instance: ExcelInstance2 Value: ExcelData Column: $'''A''' Row: 1
     SET Counter TO Counter + 1
     Excel.CloseExcel.Close Instance: ExcelInstance3
    END
    Excel.GetAllWorksheets Instance: ExcelInstance2 Worksheets=> SheetNames
    Excel.AddWorksheet Instance: ExcelInstance2 Name: $'''Final Data''' WorksheetPosition: Excel.WorksheetPosition.Last
    LOOP FOREACH CurrentItem4 IN SheetNames
     Excel.SetActiveWorksheet.ActivateWorksheetByName Instance: ExcelInstance2 Name: CurrentItem4
     Excel.GetFirstFreeColumnRow Instance: ExcelInstance2 FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow
     Excel.ReadFromExcel.ReadCells Instance: ExcelInstance2 StartColumn: $'''A''' StartRow: 1 EndColumn: $'''B''' EndRow: FirstFreeRow ReadAsText: False FirstLineIsHeader: False RangeValue=> ExcelData2
     Excel.SetActiveWorksheet.ActivateWorksheetByName Instance: ExcelInstance2 Name: $'''Final Data'''
     Excel.GetFirstFreeColumnRow Instance: ExcelInstance2 FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow
     Excel.WriteToExcel.WriteCell Instance: ExcelInstance2 Value: ExcelData2 Column: FirstFreeColumn Row: 1
    END
    Excel.DeleteColumn Instance: ExcelInstance2 Column: $'''A'''

    I have created flow for as per your requirement you can copy this code and paste into your flow .

     

     

    (Note:- if you got your solution you can mark as solution and gives kudos)

     

    Thanks & Regards

    Chetan Ninghot

     

      

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Honestly, while you did put in the effort to deserve a thumbs up, I won't do that mainly because you should not provide end to end solutions to people who just come here and describe what they want to do, but do not actually even try doing it themselves. This is a community for helping people who struggle with the tool. It's not a site to get solutions delivered for free.

  • CU31080729-3 Profile Picture
    502 Moderator on at

    Hi,

    Ya your right Agnius  👍

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 541

#2
Valantis Profile Picture

Valantis 479

#3
Vish WR Profile Picture

Vish WR 470

Last 30 days Overall leaderboard