community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx Knowledge Base

Definitive answers from Designer experts.

Download a Zipped Excel File from an Amazon S3 Bucket

Moderator
Moderator
Created on

Question

Can I read in an Excel file located in a zipped archive file from Amazon S3?

Answer

Unfortunately, this is not an option within the Amazon S3 Download Tool, as it only allows you to choose between CSV, DBF and YXDB files. However, this is possible within Alteryx with the use of a simple workflow utilizing a three line batch file, the Run Command Tool (master it here), and the AWS Command Line Interface (CLI).

 

In order to use the CLI, you must first download it and configure its settings. Please visit this page for information on how to do that. Once that is setup, you simply need to setup the batch file and configure the Run Command Tool.

 

Step 1

In the first step, you will use a Text Input Tool to write the batch file code. This code will use the CLI to copy the ZIP file from the S3 bucket to a locally accessible drive. Configure the Text Input Tool as follows:

 

TextInput.png

 

Important:

  • Make sure that line 2 points to where your CLI is installed.
  • In line 3, replace "alteryxtest" with the name of your bucket, "ExcelTest.zip" with the name of your ZIP file and enter in the correct location to copy the file to.

 

Step 2

In the second step, you will use the Run Command Tool to do the following:

  1. Write out the batch file ("Write Source")
  2. Run the batch file created in the previous step ("Run External Program")
  3. Read the file into the workflow ("Read Results")

RunCommand.png

 

Important:

 When entering in the "Read Results" section, your ZIP file will not exist at this point so you cannot simply navigate to and select the file. So, you have two options:

  1. Click on the "Input" button and enter in the full path of where you are copying the ZIP file (found on line 3 of the Text Input tool) along with the file name, a pipe character, and then in brackets, the sheet name. For Example:

    C:\Users\dchapman\ExcelTest.zip|ExcelZIP.xlsx[sheet1]
    
  2. Run the workflow once without the "Read Results" section completed in order to copy the ZIP file from the S3 bucket. Then, click on the "Read Results" button and navigate to the ZIP file and choose the Archive file to read it. 

 

This same workflow can be used to read other archived files as well. However, you will have to make slight adjustments to the "Read Results" section of the Run Command tool. For example, if reading in a CSV file, you would simply include the archived file name. Since a CSV file does not have "sheets", the bracketed sheet name is not needed.

 

I plan to create a simple macro with a user interface that will do the same thing. Once complete, I will post it in the reply section.

 

Thanks for reading!

Comments
Alteryx Certified Partner
Alteryx Certified Partner

It would be good to offer this functionality natively in the product as most users will have zipped files etc that they wish to pull from s3

Moderator
Moderator

Hi @adrianloong,

 

Thanks for your comment. I agree 100%. If you wouldn't mind, you could always add that suggestion to the Product Ideas section of the Community. If your idea gets a lot of attention, then it will get the attention of our developers.

 

Thanks!

Atom

Hello,

 

It would be interesting to increase the range of file types that the connector can read, for example the Excel file itself.

I am trying to use the workaround explained in the post. I am getting the following error about .bat not being valid format.

Error: Run Command (5): The file "C:\Users\XXXX\Desktop\alteryx_cp_gz_file.bat" is not a known format. (2)

 

Is it possible that my my admins have disabled the use of .bat files?alteryx_issues.JPG

 

I am trying to use the workaround explained in the post. I am getting the following error about .bat not being valid format.

Error: Run Command (5): The file "C:\Users\XXXX\Desktop\alteryx_cp_gz_file.bat" is not a known format. (2)

 

Is it possible that my my admins have disabled the use of .bat files?alteryx_issues.JPG