0017 Delete sheet from excel files in directory

A practical Advanced ETL Processor example for building, testing, and adapting one automation workflow.

Advanced ETL Processor
4.9 ★★★★★ Based on 16 reviews on Capterra See all reviews on Capterra →

Use this example to build one working automation package, test it safely, and then adapt it to your own files, folders, or data rules. Start small. Automation is helpful; automated mistakes are just faster mistakes.

Delete one worksheet from every Excel file in a folder

This example shows how to loop through Excel files in a directory and delete the same worksheet from each file. It is useful when source files arrive with an unwanted sheet, a temporary sheet, or a sheet that should not be loaded downstream. Test it on copies first. Bulk deletion is efficient, and efficiency is not the same as forgiveness.

Run the example

  • Download and install Advanced ETL Processor [Link]
  • Download and unzip the example [Link]
  • Create a new package and open the .wfp file.

Delete sheet from Excel files in directory package

Set the folder path

Double-click the Set Variables action and change the folder path to the directory containing the Excel files.

Set variables action for Excel folder path

Select the files to process

Change the file extension if necessary. The package uses the file operation step to find the Excel files that should be processed.

File operation for selecting Excel files

Loop through the files

The loop processes each matching file in the directory. Each file is passed to the delete sheet action before the package moves on to the next file.

Loop through Excel files in directory

Delete the worksheet

The Delete Sheet action removes the configured worksheet from the current Excel file. Make sure the sheet name is correct before running this against production files.

Delete Excel sheet action

Clean up temporary files

The package can remove temporary files after processing, so the working folder does not fill up with leftovers from previous runs.

Delete temporary file action

Run the package

Run the package by pressing the green arrow. Review the output files after the first run before scheduling the package.

More information

Related Advanced ETL Processor resources

For more automation examples, review the Advanced ETL Processor tutorials, read the WIKI, or download the Advanced ETL Processor Enterprise trial.