Oh no! The Community appears to be haunted! Help us find all the spooky specters here.
We are currently experiencing an issue with Email verification at this time and working towards a solution. Should you encounter this issue, please click on the "Send Verification Button" a second time and the request should go through. If the issue still persists for you, please email support@alteryx.com for assistance.

Alteryx Designer Discussions

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

Input data from Alteryx into Word Document Template

ACarr116
5 - Atom

Hi All, this is my first time posting so please forgive me if I'm in the wrong spot.

 

I am trying to input the data from my Alteryx model into a pre-designed/populated Word document.

 

My current model takes the results, and creates a separate word document for each row of data, but I'd like to be able to go one step further and have it drop the cell contents into a specific part of an already generated/ designed template in Word.

 

Does any one have any thoughts/ ideas that might work?

2 REPLIES 2
patrick_mcauliffe
14 - Magnetar
14 - Magnetar

@ACarr116just to clarify, when you refer to a "Word document", you mean the one with file extension .docx?  Or does it just need to be a text document that Word can open?

 

The easiest way I've found to do something similar is by creating variables in a txt.  Sometimes you can get a .doc to work if there aren't any rich text features (coloring, special symbols, etc).

The hardest part you'll run into on any of these is selecting the right code page.  That's mostly why I avoid .docx.

 

 

For example, let's say you wanted to replace text to batch create a dozen forms for individuals based on a data set you have about them.

In this case, let's use a resume as an example.

Here's our template .txt document:

patrick_mcauliffe_0-1576942540227.png

 

Our incoming data set looks like this:

patrick_mcauliffe_2-1576942986024.png

 

 

First, figure out what codepage the document is (this is why I stick to .txt).

Usually it will be ANSI - Latin I, ISO 8859-1 Latin I, or Unicode UTF-8.

Open the document as a csv with no delimiter.  When browsing for the file you may have to change the file type to "All Files" instead of the default "All Data Files" for the text document to show up.

 

patrick_mcauliffe_4-1576943214977.png

 

 

The rest is just appending and a replace formula.

patrick_mcauliffe_5-1576943443854.png

 

 

The important thing to remember is that you either need to ensure the variables you're using to replace (place holders like "LAST NAME", "COMPANY", etc) are unique within the document or there are multiple conditions within your formula (such as a row ID to clarify which one to replace),

 

After the replace formula, just concatenate using the regex "\n" to concatenate new rows like a document (group on the input ID first if multiple).

 

patrick_mcauliffe_6-1576943679515.png

 

 

Convert each concatenated group to a blob.

patrick_mcauliffe_7-1576943742100.png

 

Give each blob a unique name (another good reason to use a row ID).

patrick_mcauliffe_0-1576943896068.png

 

And finally use the blob output to create your new files.

patrick_mcauliffe_1-1576943966462.png

 

 

 

 

 

trettelap
8 - Asteroid

This looks great and really useful! Any way you could upload this workflow?

Labels