Creating Word Documents from data in an excel doument, but the name and location of the excel document will change

Simon Barrington 0 Reputation points
2026-11-25T18:05:56.2833333+00:00

Most of this I have done before, and populating the word template from an excel file I can do easily enough, but what if the name and location of the source excel file changes.

Example:

I have an Excel Table that has data for individual staff members for a particular job. The name and location of the excel file will change within Sharepoint depending on the job, but the file format will remain the same... same layout, just differing data within the table. The Word Template is the same every time and can always remain the in the same place within Sharepoint

I would like to have a button on the Excel document that triggers a Power Automate flow to compose letters (word document) to each staff member for that particular job.

In power automate I know how to List rows present in a table, but it I can't work out how to change the source of the table to the file I am working on.

Location: Will always be the same

Document Library: will always be the same

File: Always changes

Table: will always be the same

Any suggestions would be great. I have a resonable understanding of power automate, but writing code is not my thing!

Microsoft 365 and Office | Office Online Server
0 comments No comments

2 answers

Sort by: Most helpful
  1. Aetherin 4,835 Reputation points Independent Advisor
    2026-11-25T18:35:46.07+00:00

    Hi @Simon Barrington,

    Thanks for sharing your question and for providing a clear description of the scenario.

    From your description, it sounds like you're looking for a way to have a Power Automate flow work with whichever Excel workbook is being used for a particular job, without having to hardcode a specific file into the flow. While the workbook name and its folder location may vary, the overall structure, table format, and Word template remain consistent.

    Since this question is more closely related to Power Automate, SharePoint, and the Excel Online (Business) connector than to Office Online Server itself, you may receive more specialized guidance from the Power Automate community. The Office Online Server forum is primarily focused on the deployment, configuration, maintenance, and troubleshooting of Office Online Server environments rather than workflow automation and connector-based solutions within the Power Platform. As a result, community members here, myself included, may not have the depth of expertise needed to provide the most accurate guidance for this particular scenario.

    I would recommend posting your question in the Microsoft Power Platform Community, where members are better positioned to assist with Power Automate workflow and connector-related questions.

    User's image

    I apologize for redirecting you to another community, but this will help ensure your question reaches the appropriate specialists. When reposting, it may be helpful to mention that the SharePoint site, document library, table name, and Word template remain unchanged, while only the Excel workbook name and storage location vary between jobs.

    Thank you for your understanding, and I hope you're able to find the guidance you need.

    Was this answer helpful?

    1 person found this answer helpful.

  2. Nafisat Badmus 80 Reputation points
    2026-11-25T23:06:32.0566667+00:00

    You can do this without code. The trick is to start the flow from the file itself, so the flow is told which workbook to use:

    1. Trigger: SharePoint – For a selected file. Pick your site and the library the job workbooks live in. The flow then shows up under the Automate menu in that library. Select the job workbook, click Automate, and choose your flow.
    2. Get file properties (SharePoint), using the ID from the trigger. This gives you the workbook's Identifier.
    3. List rows present in a table (Excel Online Business). Set Location and Document Library as usual. For File, choose "Enter custom value" and insert the Identifier from step 2. For Table, type the table name exactly, for example tblStaff, as a custom value. The dropdown won't list it because the file is dynamic. That's fine.
    4. Apply to each row, then Populate a Microsoft Word template (Word Online Business) pointing to your fixed template, followed by Create file in SharePoint. Use the staff name in the file name and save into the job's folder. You can add Convert Word Document to PDF if you send PDFs.

    Two things to know. First, "Populate a Microsoft Word template" is a premium action, so whoever owns the flow needs a Power Automate Premium licence. Second, the template needs content controls added through Word's Developer tab before the flow can see its fields.

    If you'd rather have a button inside Excel, use the For a selected row trigger from the Automate tab. Selecting the file from the library is usually simpler when the workbook name keeps changing, though.

    Happy to help further if useful.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.