Okay, so here is the confusion. The post said Worksheets so I suggested a logic related to sheets for 1 file and the same to be repeated for other files in the folder.
From your screenshot it is clear that it is Workbooks.
You just need to iterate through the files in folder before running the sheets logic above.
Here is the modified logic.
- Copy Paste the below code in a blank Flow Editor and Test the Flow.
- Make sure to run it against a copy of the Excel files and not the original files.
- Change the path in the code
- Refer to the comments in the code
SET InputFolder TO $'''C:\\Test\\MyFolder'''
Folder.GetFiles Folder: InputFolder 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=> Files
LOOP FOREACH CurrentItem IN Files
Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: CurrentItem Visible: True ReadOnly: False Instance=> ExcelInstance
Excel.SetActiveWorksheet.ActivateWorksheetByName Instance: ExcelInstance Name: $'''Sheet1'''
# Set the correct Sheet name here from where you want to delete the rows.
SET RowCounter TO 1
LOOP WHILE (RowCounter) <= (3)
Excel.DeleteRow Instance: ExcelInstance Index: 1
Variables.IncreaseVariable Value: RowCounter IncrementValue: 1
END
Excel.CloseExcel.CloseAndSave Instance: ExcelInstance
END