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'''
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.
Hi @Alphadrag
Please refer two different solutions suggested by @mattias1172 and @MichaelAnnis in the post below.
Hi @Alphadrag
Please follow these steps.
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 ,
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
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'''
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
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.