cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alphadrag
Helper IV
Helper IV

Remove post

removed

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ahammad_Riyaz
Super User
Super User

Hi @Alphadrag 

 

In that case best approach you can use One template excel with all excel column headers.

and directly write excel with using get free column and row and every time it will write data.

You can use same code just copy paste into PAD

 

Folder.GetFiles Folder: $'''C:\\Users\\Ahammad Riyaz\\Downloads''' FileFilter: $'''*.xlsx''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files3
Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''template.xlsx''' Visible: True ReadOnly: False Instance=> ExcelInstance8
LOOP FOREACH CurrentItem5 IN Files3
    Excel.GetFirstFreeColumnRow Instance: ExcelInstance8 FirstFreeColumn=> FirstFreeColumn4 FirstFreeRow=> FirstFreeRow4
    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: CurrentItem5 Visible: True ReadOnly: False Instance=> ExcelInstance9
    Excel.GetFirstFreeColumnRow Instance: ExcelInstance9 FirstFreeColumn=> FirstFreeColumn3 FirstFreeRow=> FirstFreeRow3
    Excel.ReadFromExcel.ReadCells Instance: ExcelInstance9 StartColumn: 1 StartRow: 3 EndColumn: FirstFreeColumn3 - 1 EndRow: FirstFreeRow3 ReadAsText: False FirstLineIsHeader: False RangeValue=> ExcelData
    Excel.CloseExcel.Close Instance: ExcelInstance9
    Excel.WriteToExcel.WriteCell Instance: ExcelInstance9 Value: ExcelData Column: 1 Row: FirstFreeRow4
END
Excel.CloseExcel.CloseAndSaveAs Instance: ExcelInstance8 DocumentFormat: Excel.ExcelFormat.FromExtension DocumentPath: $'''Final.xlsx'''

 

Ahammad_Riyaz_0-1648453214293.png

 

 

Regards

Ahammad Riyaz

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

9 REPLIES 9
VJR
Super User
Super User

Hi @Alphadrag 

 

Please refer two different solutions suggested by @mattias1172 and @MichaelAnnis in the post below.

 

https://powerusers.microsoft.com/t5/Power-Automate-Desktop/Power-Automate-Desktop-Merging-Appending-...

 

Ahammad_Riyaz
Super User
Super User

Hi @Alphadrag 

Please follow these steps.

Ahammad_Riyaz_0-1648443057560.png

 

Regards

Ahammad Riyaz

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

removed

Ahammad_Riyaz
Super User
Super User

Hi @Alphadrag ,

 

In that case,

After Launch excel you have to use get free row and column action,

After that use for each.

In write excel use variable for rows write variable, Freerow-1

 

Regards

Ahammad Riyaz

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

removed

Ahammad_Riyaz
Super User
Super User

Hi @Alphadrag 

 

In that case best approach you can use One template excel with all excel column headers.

and directly write excel with using get free column and row and every time it will write data.

You can use same code just copy paste into PAD

 

Folder.GetFiles Folder: $'''C:\\Users\\Ahammad Riyaz\\Downloads''' FileFilter: $'''*.xlsx''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files3
Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''template.xlsx''' Visible: True ReadOnly: False Instance=> ExcelInstance8
LOOP FOREACH CurrentItem5 IN Files3
    Excel.GetFirstFreeColumnRow Instance: ExcelInstance8 FirstFreeColumn=> FirstFreeColumn4 FirstFreeRow=> FirstFreeRow4
    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: CurrentItem5 Visible: True ReadOnly: False Instance=> ExcelInstance9
    Excel.GetFirstFreeColumnRow Instance: ExcelInstance9 FirstFreeColumn=> FirstFreeColumn3 FirstFreeRow=> FirstFreeRow3
    Excel.ReadFromExcel.ReadCells Instance: ExcelInstance9 StartColumn: 1 StartRow: 3 EndColumn: FirstFreeColumn3 - 1 EndRow: FirstFreeRow3 ReadAsText: False FirstLineIsHeader: False RangeValue=> ExcelData
    Excel.CloseExcel.Close Instance: ExcelInstance9
    Excel.WriteToExcel.WriteCell Instance: ExcelInstance9 Value: ExcelData Column: 1 Row: FirstFreeRow4
END
Excel.CloseExcel.CloseAndSaveAs Instance: ExcelInstance8 DocumentFormat: Excel.ExcelFormat.FromExtension DocumentPath: $'''Final.xlsx'''

 

Ahammad_Riyaz_0-1648453214293.png

 

 

Regards

Ahammad Riyaz

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

removed

Hi @Alphadrag 

 

Excel instance you are defined wrong i think, just pass the Launch excel template ---instance1 same instance u hav to give in Write excel 21st line

removed

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (2,802)