Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

How to convert tablular data set to base64

danishimam
7 - Meteor

Hello All,

 

I have a requirement to convert the excel file like data (not excel file) into a binary base64. I was able to write the file > read the file into Blob Input tool > convert to base64 using Blob Convert tool.

But I do not want to go with above approach to write the file and then read it, instead can we directly convert the data into base64?

 

I am looking to convert the tabular data (from Text Input tool) to a single string cell, which can be used as an input to Base64 encoder. Below is a simple flow which shows the tabular data, which needs to be converted to base64.

Please let me know if anyone has got into this usecase and how you were able to achieve this. THank you for your support.

 

danishimam_0-1640637643008.png

 

Thanks,

Danish

3 REPLIES 3
Treyson
13 - Pulsar
13 - Pulsar

I will take a stab at this. I believe that if you use the reporting tool called "table" it should work. It creates an XML object and then you can base 64 encode that. See attached.

Treyson Marks
Senior Analytics Engineer
danishimam
7 - Meteor

@TreysonThank you for helping me out. I tried to use "table" tool and it was able to take the table input and convert to base64.

 

I am sorry i would have given more details on what we do with this base64 data. I have to send this base64 data to an API which uploads file. The API internally decodes this base64 string and upload the file in its original content.

Since we have used "table" tool, and got the base64 output, when the API uploaded the file it got the XML instead of XLSX file (although filename still says out.xlsx).

 

XML uploaded:

<div class="d2455e88e83c549f2a67bbda38e84c0f2" width="100%"><style>
.d2455e88e83c549f2a67bbda38e84c0f2 thead .column0 { numeric:false; } 
.d2455e88e83c549f2a67bbda38e84c0f2 .column0 { text-align:left; } 
.d2455e88e83c549f2a67bbda38e84c0f2 thead .column1 { numeric:false; } 
.d2455e88e83c549f2a67bbda38e84c0f2 .column1 { text-align:left; } 
.d2455e88e83c549f2a67bbda38e84c0f2 tbody td { font-family: Arial; font-size:8; color:#000000; vertical-align:top; }
.d2455e88e83c549f2a67bbda38e84c0f2 tr.evenRow { background-color:#ffffff; }
.d2455e88e83c549f2a67bbda38e84c0f2 tr.oddRow { background-color:#f0f0f0; }
.d2455e88e83c549f2a67bbda38e84c0f2 thead tr { background-color:#dbdbdb; }
.d2455e88e83c549f2a67bbda38e84c0f2 thead td { vertical-align:top; font-family: Arial; font-size:10; color:#000000; }

</style><datatable style="border: 1px solid #000000;" width="100%" cellspacing="0px" cellpadding="0px" rowGroupSize="1" rowsContained="4"><views><dataview></dataview></views><columns><col/><col/></columns><thead><tr class="headerRow"><td class="column0">field1</td><td class="column1">field2</td></tr></thead><dbody><dr><cell class=" column0" style="" >a</cell><cell class=" column1" style="" >hello</cell></dr><dr><cell class=" column0" style="" >b</cell><cell class=" column1" style="" >world</cell></dr><dr><cell class=" column0" style="" ></cell><cell class=" column1" style="" ></cell></dr></dbody></datatable></div>

 

Expected XLSX file to be uploaded as tabular sheet with rows and columns. Is there any other option?

Thank you

Danish

 

 

Treyson
13 - Pulsar
13 - Pulsar

Okay wait are you sending a base64 encoded xlsx file? That, I believe, is going to be something that requires command line or python. Are you also wanting to use Alteryx to call the API?

 

I think that you would have to write the file first and then use something like this to encode the file. I believe that you could write the file using the python tool then encode it in the same script in order to ensure that the file writes before trying to encode.

 

You could also do that API call from python if you wanted to.

Treyson Marks
Senior Analytics Engineer
Labels