Alteryx Designer Discussions

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

Reading files after python code

ferha_jafri
8 - Asteroid

Hello Experts,

 

I have a requirement in which I am using python code to unzip files now I want to read files which got unzipped, so I want to run the python code first and then the files get loaded through input tool to perform transformation.

 

Thanks in advance

Ferha Shrama

8 REPLIES 8
atcodedog05
21 - Polaris

Hi @ferha_jafri 

 

Approach 1: you can write the code to read excel file in python code only that way flow is ensured.

 

Approach 2: You can pass the file path from python tool to dynamic input tool and read. Since the dynamic input tool requires the path it will wait for python code to complete.

 

Hope this helps : )

binuacs
12 - Quasar

@ferha_jafri the Input Tool has the ability to read the zip files, may be you can try in that way also

binuacs_0-1642181714715.png

 

apathetichell
16 - Nebula

return a data.frame of unzipped file paths (are these all files of the same type?) from the python tool.

 

feed in the file locations to a batch macro with the proper input tool and configs.

atcodedog05
21 - Polaris

Adding to above

 

or use a for loop in python change the file path to read them all and union them.

 

Hope this helps : )

ferha_jafri
8 - Asteroid

The problem in this solution which I am facing is every time the file name is changing so how to solve this for dynamic file names.

atcodedog05
21 - Polaris

Hi @ferha_jafri 

 

As i know python has a code where you can read filenames in a folder. You may want to explore that.

 

Hope this helps : )

ferha_jafri
8 - Asteroid

I am be able to extract all the files in zip through python, now I want to read pne txt file from unzipped files, so for that also you are saying the python code.Correct.

atcodedog05
21 - Polaris

Hi @ferha_jafri 

 

yes, give that a try.

Labels