Alteryx Designer Desktop Discussions

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

Counting Excel Sheets

NiallWynne
5 - Atom

Hi Community, 

 

I have an automated process where i import data from excel workbooks. Each workbook can have multiple excel sheets so i have to specify the sheet name to pick the one i want. But, is there a way of determining if an excel workbook has only 1 sheet associated with it and so import the data from that one sheet without specifying the sheet name?

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @NiallWynne 

 

Seems like this might require a macro. Can you provide sample file and expectation so that we can better help you out.

NiallWynne
5 - Atom

A sample file would really just be two random excel workbooks. One with one sheet and the other with two sheets. I have attached. It's the method of determining if the workbook has one or multiple sheets associated with it that i'm really after. Hope this helps. 

atcodedog05
22 - Nova
22 - Nova

Hi @NiallWynne 

 

You can do something like this.

 

Workflow:

atcodedog05_1-1627025148487.png

 

1. You can configure input file path with wildcard to read all files.

2. You can configure query mode to list of sheet names.

3. You can configure to output filename.

 

This way you will get filename and all it sheets. Once you have made selection to can pass the specific row through dynamic input tool to read the data.

 

Hope this helps : )

grchavarri
11 - Bolide

Hi @NiallWynne 
The solution from @atcodedog05 is good if you have similar sheet schema, if not, you should use a macro as attached to read any xlsx file in a folder. 

Please find attached the workflow and the macro.

 

grchavarri_2-1627029264694.png

 

I have configured in the macro, a record creator with a limit of 20 sheets but you can change it if you need so.

grchavarri_1-1627029169089.png

 

Hope it helps 

 

Best, 

Labels