ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
RÉSOLU

Delete Empty Sheets from excel workbook

Fadi313
Météoroïde

I have an excel workbook having 100 Sheets most of them are empty, wants to delete the empty sheets only and then send the updated workbook to my team.

 

Regards

9 RÉPONSES 9
FrederikE
Pulsar

Hey @Fadi313 

 

Is the table structure the same throughout the file? Then you could load it in altogether, including the sheet name.

This would result in no lines for empty sheets and the input files being stacked on top of each other. Then you could write the output file directly, using the sheet names. You wouldn't get any empty sheets, as those have no rows in the Input file (at least I think so (otherwise you would need a simple filter)). 

Fadi313
Météoroïde

Hi
The table structure is different, Sorry your solution did not work.

Hi, @Fadi313 you can try it using a macro.

Input sheet names from the file.

grazitti_sapna_0-1659067890081.png
Macro Output will remove the empty sheets. In my case sheet3 and sheet4 are empty. Then you can update your workbook using the output tool.

grazitti_sapna_1-1659067931941.png

 

I hope this will solve your purpose.

 

Thanks!

 

 

Sapna Gupta
Fadi313
Météoroïde

Hi Sapna,
Thank you for your reply , the empty sheets have been removed but each sheet in the output workbook have all sheets headers.

 

Fadi313_0-1659070531673.pngFadi313_1-1659070568173.png

Thank you

@Fadi313, Yes it will have all the sheet headers as we are combining the data in a single table from all the sheets. 

 

Thanks!

Sapna Gupta
Fadi313
Météoroïde

 there is no way to keep the correct header for each sheet

@Fadi313, there is one way but in that case you will have to create a new workbook and copy the sheets in that.

grazitti_sapna_0-1659071882519.png

But in that case, you will have to change the filename every time and create a separate file for all the workbooks.

I have simply added an output tool in the macro which will read the sheet one by one and will keep creating a new sheet in your new workbook.

grazitti_sapna_1-1659071983890.png

 

Posting the updated workflow.

 

I hope this helps!

 

Thanks!

 

Sapna Gupta
Fadi313
Météoroïde

Thank you a lot for your help and quick response. 
Have a great day

@Fadi313, welcome. Glad it worked for you!

Sapna Gupta
Étiquettes
Auteurs des meilleures solutions