Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Delete Empty Sheets from excel workbook

Fadi313
6 - Meteoroid

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 REPLIES 9
FrederikE
13 - 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
6 - Meteoroid

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

grazitti_sapna
17 - Castor

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
6 - Meteoroid

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

grazitti_sapna
17 - Castor

@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
6 - Meteoroid

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

grazitti_sapna
17 - Castor

@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
6 - Meteoroid

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

grazitti_sapna
17 - Castor

@Fadi313, welcome. Glad it worked for you!

Sapna Gupta
Labels