Alteryx Designer Desktop Discussions

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

How to check if a excel file exist in a direcotory

nazuk
8 - Asteroid

Hello All,

 

there are two files in a directory. Both of the files have dynamic input name in the format TSE082QT_DD_MM_YYYY_HHMM and Outstanding_TSE082QT_DD_MM_YYYY_HHMM. So TSE082QT_DD_MM_YYYY_HHMM will always exist, but outstanding_TSE082QT_DD_MM_YYYY_HHMM may or may not exist. So basically, if Outstanding_TSE082QT_DD_MM_YYYY_HHMM exist , the it should get appended to the TSE082QT_DD_MM_YYYY_HHMM.

 

I have tried to code to check if  outstanding_TSE082QT_DD_MM_YYYY_HHMM exist in the directory Exist. 

 

Can somebody please help me on how i can input that file if it exist.

 

 

 

 
 
 
 
 
 
 

 

 

 

 
 
 
 
 

 

 

 

 

11 REPLIES 11
joshuaburkhow
ACE Emeritus
ACE Emeritus

Hi @nazuk 

 

You'll want to do something like this using the directory tool, filter tool, and dynamic input tool 🙂 

 

joshuaburkhow_0-1586086633166.png

 

Joshua Burkhow - Alteryx Ace | Global Alteryx Architect @PwC | Blogger @ AlterTricks
grossal
15 - Aurora
15 - Aurora

Hi @nazuk,

 

I see a couple of options here. If it's guaranteed that only two files are in the folder, you could use wildcards for the whole data type.

 

C:\path\*.xlsx

 

If you have more than those two file in the folder, you could use:

 

C:\path\*TSE082QT*.xlsx

 

If you want to be even more flexible, you could use a Directory Tool, a Filter Function and the Dynamic Input.

 

Let me know if this helps.

 

 

Best

Alex 

nazuk
8 - Asteroid

@joshuaburkhow :

 

Thanks for the quick response. CAn you please help me in getting the formula for file name, since not neccesarily, it will be today's date, it can be any date and any time. Just the keyword will be same.

nazuk
8 - Asteroid

@grossal : Thanks for the reply.

 

So basically i want to use first option, since one of the file will have dynamic worksheet name too.

 

So basically i am using directory tool, then i have applied filter, but then can i directly use dynamic input tool after filter, or do i need to write a formula first to specify file name?

 

If yes, can you help me with a general formal as how we specify a file name?

grossal
15 - Aurora
15 - Aurora

Hi @nazuk,

 

I have just tested it. It worked without specifying the sheet name.

 

grossal_0-1586090444041.png

File 1) 25 Rows (Sheet1)

File 2) 6 Rows   (Sheet1)

File 3) 6 Rows   (changed sheet name to 'custom')

 

-> 37 total rows.

 

Make sure to set "Field" to "FullPath" and Action to "Change Entire File Path".

 

grossal_1-1586090584694.png

 

 

 

Best

Alex

 

nazuk
8 - Asteroid

Hi Alex,

 

I am getting following error:

 

 

nazuk_0-1586097563847.png

 

 

nazuk_0-1586096582765.png

 

I am attaching excel file as well for the format of file name and sheet name.

 

 

 

nazuk
8 - Asteroid

@grossal : Attaching files

grossal
15 - Aurora
15 - Aurora

Thanks for the files.

 

I'd go with a simple attempt:

 

grossal_0-1586105547787.png

Obviously this workflow will fail if the outstanding file does not exist, but we still get the result we want. If it does exist, it will append the data, if it doesn't exist, nothing will happen and the workflow fails.

 

Alex

nazuk
8 - Asteroid

This is not working, i am still getting error in case one file not exist and that is not that i have to write as an output. just have to append in my first file and use it for next part of the report

Labels