Alteryx Designer Desktop Discussions

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

How to read only the latest sheet in the excel

umairah
8 - Asteroid

Hi, 

I got an excel file that contain monthly data and every month new sheet will be added to the same excel file that contain data for that particular month. 
e.g : JAN 21, FEB 21, MAR 21,....

My situation right now is I want to read only one sheet per month which is the latest month in the excel file. Is there a way to achieve this.. Any help is appreciated.

 

Regards,

Umairah

7 REPLIES 7
Qiu
20 - Arcturus
20 - Arcturus

@umairah 
Do you have a sampel data?

We can get the Sheet Name as list then do something from there.

apathetichell
18 - Pollux

without sample filenames this is pretty hard to do...  Here's a sample workflow - but this might not help you at all depending upon how your sheets are named...

umairah
8 - Asteroid

Hi @Qiu & @apathetichell 

Sorry I will put sample file for you to test.

Regards,
Umairah

ArtApa
Alteryx
Alteryx

Hi @umairah - Here is a sample workflow for you:

 

ArtApa_0-1625458870733.png

 

apathetichell
18 - Pollux

Here's how my workflow would be adapted to your filename specifics... My workflow and requires  that each month's sheet has the same schema - if that's not the case the workflow requires a different approach at the end.

ArtApa
Alteryx
Alteryx

@apathetichell - You don't need all the Sheets to be in the same schema. You only need the same schema, if you want to stack multiple sheets on top of each other using one Input Data or one Dynamic Input. However, in this scenario you need to read the latest Sheet only. Excel will allow only one Sheet in a file with the same name. That means you can have anything there. I added the following to the sample file:

ArtApa_0-1625463782614.png

and it worked well:

ArtApa_1-1625463818335.png

 

 

apathetichell
18 - Pollux

@ArtApa- yup - I see you added a step I didn't have which gets around my  potential problem (ie... I was running off of sheet name and the original file name) whereas you have intelligently created a full path with a specific sheet which gets around that silliness. IRL I'd probably use a batch macro but I was more concerned with replicating a date compatable syntax for the worksheets than making a batch macro on this one...

Labels