Free Trial

Alteryx Designer Desktop Discussions

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

Can Alteryx autofit column widths in a rendered Excel output?

ALT_2358
9 - Comet
9 - Comet

Hi,

 

I have an Alteryx workflow which produces a rendered output - this could have varying numbers of columns, depending on the user's uploaded dataset. 

 

To ensure all columns are included in the output, I've set the rendered page size to a large number. However, the column widths are very large as a result - until the user selects all columns and resizes them. I've attached an example file.

 

Is there a way to get Alteryx to automatically resize the columns or to automatically run an Excel macro on a rendered output to autofit columns?

 

Thanks

2 REPLIES 2
BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@ALT_2358 I was searching for this solution myself. With the help of ChatGPT I built a pretty nice solution. 

 

I thought about using the run command in alteryx, it could launch a script and this script could open the excel file and do all the resizing using VBS (I suppose that's a better solution that Python as it's Microsoft Native) hence why I needed chatGPT for the script assistance 😂..

 

Premise of the solution

  1. create file using render tool. 
  2. pick up file name from created file (whatever logic you like) i.e. control container or formula tool with block until done.
  3. read file name into the vbs script. Get command prompt to run this script and overwrite the existing file with the newly formatted one.

Screenshot 2024-11-16 002032.png

I'm attaching an example on a dummy workflow in Alteryx with this method. See what you think. Also, if you don't like command prompt popping up whilst the file is doing it's thing, you can just select the checkbox on the run command for it to be silent/minimised

 

This is also iterates through all the tabs on a file by the way. Pretty cool stuff.

 

Last thing to mention that I found:

It really helps by making the output really wide, then when we autofit with this method, it gets it to the perfect stretch

Screenshot 2024-11-16 002902.png

 

Might be worth a blog post for this one! Let me know if it works @ALT_2358 

 

All the best,

BS 

 

 

All the best,
BS

LinkedIN

Bulien
ChrisTX
16 - Nebula
16 - Nebula

I have a Powershell script I can dig up if you're interested.  The script includes all of the Excel formatting listed in this Idea:

 

 

Enhance options for Excel output
https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Ideas/Enhance-options-for-Excel-output/idi...

 

The Idea itself could use a few more Likes.

 

Chris

Labels
Top Solution Authors