Inspire EMEA 2022 On-Demand is live! Watch now, and be sure to save the date for Inspire 2023 in Las Vegas next May.

Alteryx Designer Discussions

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

Azure Blob Storage Download & Upload Tool

6 - Meteoroid

Hi All,


I want to share a macro/tool that can download and upload your file from & to Azure Blob Storage.

In this post, you can download the tool below and you will get Azure_Blob_Storage_Download&Upload.yxzp consists of Download & Upload Tool.


This macro is developed by python Code using azure blob API.


Before you use the macro, you need to configure your storage connection string by this following steps:


1. Sign in to the Azure portal.

2. Go to your storage account.

3. Click the Settings section, select Access keys.

4. Your Connection string value is under key1.

Connection String.png






5. Open your cmd and enter the following command :

setx AZURE_STORAGE_CONNECTION_STRING "<yourconnectionstring>"


Click here for more detail :



1. AZB Download


In AZB Download macro, you can specify the container name & server folder path (optional).

You can also download your file in a subdirectory. You can download your file and read directly to Alteryx, or download your file into a local path. When you choose to read the file directly into Alteryx, you only read the csv/xlsx/txt file(s).


AZB Download.JPG


2. AZB Upload


In AZB Upload Tool, you also need to specify the container name & server folder path (optional). You can upload your file from the Alteryx workflow, from a file, or upload it from a local folder. When you uploading your file from Alteryx workflow, you can specify file type (csv, xlsx, or txt) and also specify your sheet name for excel type.



















10 - Fireball


Is this solution version dependent? Will it work with 2020.3 ?



7 - Meteor

great solution . but facing this error while running the download macro.


Error: Azure Blob Download (1): Tool #1: ---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-7591a47e4e5a> in <module>
1 import os, uuid
----> 2 from import BlobServiceClient, BlobClient, ContainerClient
3 import pandas as pd
4 import tempfile
5 from wcmatch import fnmatch
ModuleNotFoundError: No module named 'azure'

Error: Azure Blob Download (1): Tool #1: ---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-b287f6416c58> in <module>
11 localdir = param.values[7][1]
---> 13 blob_service_client = BlobServiceClient.from_connection_string(connect_str)
15 if is_read_to_alteryx=='True':
NameError: name 'BlobServiceClient' is not defined

7 - Meteor

Hey meghak1590! 


We had the same error pop up over here. We opened the macro, and in the Python tool, the first cell in the code had a typo. Make sure that both references to azure-blob-storage have dashes instead of periods: 



Once we changed that, there was a second module error for "wcmatch". I copied the same syntax from cell one and added it to an additional cell, changing the package from 'azure-storage-blob' to "wcmatch" and that was resolved. My assumption is people with more Python experience (I'm a complete noob) probably have this module already installed. 




Unfortunately for us, solving the two module installs left us with storage error exceptions we haven't yet overcome (attached the transcript). Any thoughts on how to handle this hot mess?



8 - Asteroid



@fajar_wimar @Dan_Z @meghak1590 

Would it be possible for you to share the Python code inside the Python tool in the macro? When I download it, it is blank and hence I'm unable to run this macro. I know sometimes Alteryx workflows don't save the code in the Python tool and I'm wondering if that's what happened. 

7 - Meteor

Hi @avanibhatnagar Unfortunately I don't have the code anymore either. I 'poked around' with using that macro but without much success and abandoned the pursuit for other projects. Sorry I couldn't be more helpful!

5 - Atom

The tool does not contain the python code.  Can you provide the python code you used behind the scenes for this macro?

6 - Meteoroid

Has there been any further iterations on this? i am getting the "ModuleNotFound Error" that everyone seems to be mentioning. 



6 - Meteoroid

The python code can be found when you right click the Azure Blob tool, and Open Macro.

5 - Atom

Hello, thanks for the solution. It's work for me one time and after i got this error:

Error: Azure Blob Upload (2): Tool #12: ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-3-81a1ac2f03a3> in <module>
15 local_folder_path = param.values[8][1]
---> 17 blob_service_client = BlobServiceClient.from_connection_string(connect_str)
19 if upload_from_alteryx == 'True':
~\AppData\Roaming\Python\Python38\site-packages\azure\storage\blob\ in from_connection_string(cls, conn_str, credential, **kwargs)
175 :caption: Creating the BlobServiceClient from a connection string.
176 """
--> 177 account_url, secondary, credential = parse_connection_str(conn_str, credential, 'blob')
178 if 'secondary_hostname' not in kwargs:
179 kwargs['secondary_hostname'] = secondary
~\AppData\Roaming\Python\Python38\site-packages\azure\storage\blob\_shared\ in parse_connection_str(conn_str, credential, service)
364 conn_settings = [s.split("=", 1) for s in conn_str.split(";")]
365 if any(len(tup) != 2 for tup in conn_settings):
--> 366 raise ValueError("Connection string is either blank or malformed.")
367 conn_settings = dict((key.upper(), val) for key, val in conn_settings)
368 endpoints = _SERVICE_PARAMS[service]
ValueError: Connection string is either blank or malformed.