I have an Excel document with a list of different columns (client, value, policy no) in a format like;
Client | Value | Policy No |
Client A | £50 | A1 |
Client A | £80 | A2 |
Client B | £60 | B1 |
Client B | £25 | B2 |
Client B | £90 | B3 |
Client C | £500 | C1 |
I would like to automate the process of having a word document for each client containing just the data related to them.
I have found a few different community forums about this topic but I cannot get any of them to work.
I have tried to follow this guide: https://www.bythedevs.com/post/how-to-populate-a-word-template-with-repeating-control
Which gets me most of the way, I can get separate documents but they all contain the full contents of the Excel spreadsheet, not just the rows related to 1 client.
Any help would be appreciated!
Nice! Have a great day over there and feel free to tag me in future posts; I enjoy solving puzzles! Always glad to help! Tom
Got it working! Thank you
Hi @FDUN89 ,
Here's a solution that does this except it doesn't write to a Word document (this one stops at creating a table and can be used to send to Word, send an email, other actions, etc). Here's the entire flow to the step sending to Word which you said you already have working, just need to rows specific to Indvidual clients.
The first apply to each gets all the emails (or clients in your case meaning this could be an account name) in an array and we are appending this variable with all clients from every row, including duplicate values.
Next you compose a union on your EmailList array and this removes duplicate values. So in your case, you end up with an array variable of client names, emails, account numbers, etc - whatever you want.
The last step to get your unique rows for each client is to create a filter. Here I am using the output of my client list from Compose Union and creating a filter array. The "from" is the body of the excel step (list rows present in a table) where the current item (from the union) is equal to the email value in the excel worksheet - again could be anything you want, doesn't have to be an email.
This is going to give a table of rows pertaining to an individual client. In your case immediately below create html table, inside the same apply to each, you will want to plug in your Word actions so for each client you are getting their rows in excel and pasting into word, etc.
Please mark as a solution if this is helpful! I am using this flow in a handful of variations in production and never disappoints. Always glad to help! Tom