web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Populate Multiple Micr...
Power Automate
Unanswered

Populate Multiple Microsoft Word Templates from Excel Table

(0) ShareShare
ReportReport
Posted on by 508

Hello Good People,

I have an interseting task.  Not much experience in PowerAutomate but I know it is definately possible.  Are there any documentations on how to populate a specific template from a column  (maybe based off tempalate name).  Then grab the information from the row and populate that specific Microsoft Word template.  I know I am explaining this way too simply but maybe someone has done something similar and can point me somewhere.  These are all contracts so they need specific places within the contract that has to be filled out.  Such as compensation, FTE Rate, location and targets.  Thanks for any help you can offer community!

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    You are talking about a Word Merge.  The most basic form of a Word Merge is a letter that you want to send out, so you have everyone's names and addresses in Excel that you want to send it to.  You build the Word Template using the fields of Excel.  By putting the title row (field name) into the template, when you link the Excel file and click Merge, a separate document is made for each row of Excel.  Even if you just want to do it for 1 row, I would still set it up this way.

     

    So, start by googling about Word Merge and get that set up.

     

    Once you have the Word Template and Excel File set up, it should be really easy to create your PAD to open the Word Merge file, and then click the necessary UI buttons to get you to the final product.

     

    Best of Luck!

  • VeeLearnMSFT Profile Picture
    508 on at

    Michael, thank you for taking the time to respond.  The issue I have is that we have multiple templates and when I say multiple templates I mean over 30.   A simple mail merge would work but I believe it only accommodates one template.  The template would have to be identified in the excel document, the correct has to be picked and data fed. 

    Does this make sense?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Absolutely.  Add a field for the right template (or some value that can later be converted to a template filename).

     

    From PAD, you can "Read from Excel" and choose which template to open based off that. So, if I were setting it up, I would have the previous user enter the form name into the Template column of the Excel file, ex. "Contract30.docx"

     

    Then, you should have no trouble opening Word, opening that file, and merging. 

     

    Note:  Trying to merge a single row from several populated rows may be fairly complicated.  Instead, I would have a separate merge excel file for each word merge template.  Then copy just the row you want and overwrite the merge excel file (row 2) before opening the word document.  Now, only the row you want is being merged.

  • VeeLearnMSFT Profile Picture
    508 on at

    Can this be accomplished without premium connectors?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Yes.  There are several Excel options for the free attended access, and then I would open the right word doc from CMD; then Focus Window.

     

    You can open a word doc from cmd with the following PAD:

    Open CMD Session - put in the path you want here

    Write to CMD - just put the template filename.docx in here, make sure the {Enter} button is checked

     

    This should open the Word Template, then you can use UI capabilities to Merge and Save the Merged File.

  • VeeLearnMSFT Profile Picture
    508 on at

    Michael, if i provide a couple of templates and an excel file.  I know this seems a stretch maybe crazy, but would you be able to build something simple so I can take a look at it.  I know I need the struggle to get me there but I also think it would help if I can see it.  OR I can try to build something and if you would be willing...correct it?  Also are there any palces such as ExcelForum for poweautomate to help people get started or is this the only place.  Thank you. Enjoy your day .

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    I would be more willing to correct it.  Unfortunately, I'm dealing with a rough quarter-end.  Long story short, if you get the Mail Merge part set up, the PAD part is easy.  In your Excel file, make sure you have a column for the filepath\filename to the Word Merge document required.  If all your Word Merge documents are in the same folder, then it can just be the filename.

     

    Get the Word Merge working manually.  If you can do that, then all PAD has to do is open the Excel, read the right row, get the filepath\filename from the right column, open that file, and use the UI elements to merge the Excel with that template.  None of that part is inherently difficult.

     

    However, there is another option that I just thought of.  This option would be slow, but I thought of it, so I wanted to give it to you.  The result would be the same, but you may be more comfortable with this.  Instead of creating merge templates the conventional way, you populate the merge fields with codes that would only exist in one place, such as "FTE_RATE001".  In Excel, you make the titles the same thing (or put the code in at row2 if you want to leave the title row for whoever is filling it in (I will call this the %CodeRow%, and for the below example I will assume it is in row 2).  Then, if you were to have all of these in Excel, referencing the right template, the PAD would be as follows:


    • Get First available Row
    • Set %CodeRow% to 2
    • Set %TemplateFilePathColumn% to Y (or wherever your Word Template file path is defined)
    • Set %TemplateFileNameColumn% to Z (or wherever your Word Template file name is defined) 
    • Loop from %CodeRow + 1% to %FirstAvailableRow - 1%  in Excel increment by 1
      • Read Excel (at %TemplateFilePathColumn% & %LoopIndex%) to %TemplateFilePath%
      • Read Excel (at %TemplateFileNameColumn & %LoopIndex%) to %TemplateFileName%
      • Open CMD to %TemplateFilePath%
        • Write to CMD %TemplateFileName% (Enter button checked)
      • For each column in row (%LoopIndex%) (Note: set variable to %CurrentCol%)
        • Read Excel (at %CurrentCol% & %CodeRow%) to %Code%
        • Read Excel (at %CurrentCol% & %LoopIndex%) to %Result%
        • Find & Replace (you could use UI or hotkeys to make this work)
          • Replace %Code% with %Result% - Replace All
      • End #For Each
      • Use hotkeys to save file as (whatever you want) and close the word doc
      • Close CMD
    • End #Loop

    The point is, it would run through each row, and replace all on the data inside of each word template.  This would take much longer than the other way, but it is an option.  Between the two, I would take the time to program the first option as it would be much faster.

     

     

    Best of luck!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 261 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 185

#3
Haque Profile Picture

Haque 168

Last 30 days Overall leaderboard