Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Keep excel data validation formatting

Danny-Farrar
8 - Asteroid

Hey! I've been wracking my brain with this and can't figure out a way around it so hoping someone brighter than me here will be able to.

 

For context, I have an Alteryx batch macro that uses the run command to create copies of an already formatted master excel document according to how many customer accounts are coming through the workflow. The macro then drops the data into specific cells in the newly created documents. Within the document, I am using excel's data validation as a way of creating a yes/no drop down for product selection (which then summarises for other cells).

 

The issue I have is that whenever I run this, the data validation drop down disappears in the freshly brewed excel document. This doesn't happen when I manually copy and paste the master document. I would try using radio/check boxes but for the number of products the formatting would take forever.

 

Finally, this is a customer facing document so using interface is sadly out of the question.

 

This is super specific but if anyone has solved similar in the past or has any suggestions I could try out then I'd be hugely grateful!

5 REPLIES 5
DanielG
12 - Quasar

This is just a thought, but couldnt you use a vbs script to run Excel code on the new items to re-establish the validation after the files have been moved to their final location?

 

I dont have any specific examples to share, nor do I honestly know how to write a vbs script...  But I have seen it used to refresh worksheets, etc. "on the fly"

 

Good luck.  Hopefully this helps you get started on a solution.  🙂

Danny-Farrar
8 - Asteroid

Thanks for the idea @DanielG - I have no clue about VBA code but worth looking at. Although I would add that another little quirk to this issue is that the newly created excel should be then automatically sent out to the customer - allowing a fully no-touch process from data entry to send out.

DanielG
12 - Quasar

Perhaps writing the data to a named range (instead of writing to sheet) in excel "template" instead of creating brand new excel each time.  then the data validation can be left intact and you can send the reports on the fly from the same workflow.  obviously it is a bit more complicated than that, but should be possible, and no requirement to learn vba or vb scripts?

vil
6 - Meteoroid

I have similar issue. My excel template to which I am writing gets corrupt if the sheet contains data validation. I tried writing to a named range, but got no success. Alteryx support suggested:

 

- create your formula using Alteryx and remove all the elements that corrupt your file and only preserve the format in Excel. (In this case does not apply to me, since I don't have formulas, but only data validation)

-Use the reporting tools to create the format in Alteryx. (also does not work since I cant recreate data validation)

 

Other consultants suggested:

  1. Copy the input file to the output directory with an updated file name – this preserves the formatting
  2. Dynamically read the file in and make any required changes
  3. Output a blank version of the file alongside the file copied in step 1.
  4. Deploy a VB (Visual Basic) script from within Alteryx to copy the data in the file output by step 3. into the copied file with preserved formatting in step 1.
DanielG
12 - Quasar

@Danny-Farrar and @vil 

 

For my process, I ended up creating a templated Excel file and saved it to our LAN.  Then I create copies (for each of our offices) using the Blob Input and Output tool to preserve the original template file, then I populate the office specific information to the newly created corresponding files.  At the end of my process I have a Run Command that fires off a bunch of VBA code(Workbook.Open) to complete one-time formatting of the individual documents.  Works perfectly from desktop.  Still working with our server admin (and Alteryx Support) to figure out how to get the Run Command to fire off correctly on the server.  The Run Command doesnt error out, so the files are created, but the VBA doesnt fire off until the first end-user opens the document.

 

My templated file has about 15-20 highly customized sheets, so it works for complex processes in addition to simple data dumps.

Labels