Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Power Automate Desktop
Suggested answer

Populate a Word file from Excel database

(1) ShareShare
ReportReport
Posted on by
Hi Community,
 
I create a flow to save as new .docx file from a Word template by filling plain texts from Excel table. The problem is:
- (1) flow can run smoothly but save new .docx exactly the same the provided template, it doesn't replace plain texts with texts in excel database
- I try to create dynamic file name in line 12 but doesn't work
I copy here the flow's screenshot
Really appreciated, if there's anyone give me a hand on these issues? 😅
 
Thanks in advanced
HT
 
Categories:
  • Suggested answer
    Riyaz_riz11 Profile Picture
    3,293 Super User 2025 Season 1 on at
    Populate a Word file from Excel database
    Hi,

    I recommend you verify step by step:

    1. Verify Placeholder Format

      • Open your Word template in plain view.

      • Search manually: <<—are they exactly in the format <<ColumnName>>?

      • No extra spaces inside << >> 

    2. Debug Output

      • Before your Find and Replace, insert a Display Message or Write to Text File action to log:

        Replacing: " & Concatenate("<<", %Key%, ">>") & " with: " & %Value%

      • Run the flow—confirm that for each placeholder, this logs the expected text.

      • This will instantly show if your Key/Value is empty 

    3. Double-check Excel Data

      • Make sure CurrentRow[ColumnName] is never null.

      • If any column names mismatch (header in Excel doesn’t match placeholders), you will get no replacement 

    4. Simplify the Word Instance

      • You don’t strictly need to launch and attach twice—try:

        • Only Launch Word once.

        • Reference that same Instance for all actions.

    1. [Key] and [Ten du an] are not correct dynamic variable references.

      • You should not write [Key] like this—Power Automate Desktop uses %VariableName%

     How to Fix

    Change your file path to this format:

    C:\Users\Thang01\OneDrive - dentsu\WORKING\TOOL\WORKING TEMPLATE\AUTOMATION TESTING\BBNT_RESULT\%Key%%TenDuAn%.docx

    If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
    Regards,
    Riyaz

  • Suggested answer
    eetuRobo Profile Picture
    3,645 Super User 2025 Season 1 on at
    Populate a Word file from Excel database
    Hello,

    In your 9th action Set variable Value is just setting the variable as text "CurrentRow[ColumnName]". You can check that when running the flow and checking the Value -variables vale from the variable pane on the right side.
    In Power Fx you need to always have equal sign before the variable so the flow knows that you are giving it a variable and not just text.

    Also the Save Word end of the file name is also just text "[Key[Ten du an]]". For that the syntax would be ${Key} or 
    in you case it might be ${Key.'Ten du an'}


    Action 10 Find and replace words in Word document -action also have replace with "=Value" which seems to be text and not the Value -variable. Remove the Double quotes around the =Value

    I recommend you create a new flow without Power Fx enabled since this logic will be much easier with the regular flow.

    Something like this if I understood your flow correctly:


    In Read from Excel worksheet I have this setting on to have first row be ExcelData's column names 


    Then Set variable Headers use ExcelData.Columns (this is not available in Power Fx) to get column names into list variable. In my example excel I had the first row just be named Header1, Header2 etc.


    Then  just loop the headers instead of having two loops.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1