How to Auto-Populate a Word Template from Excel by Client Number
Question details
The user needs to automatically retrieve and fill client details, such as name and email, into a Word document by inputting a client number stored in an Excel workbook.

- Product
- Word, Excel
- Device & OS
- not provided
- Scenario
- Creating client-specific documents or templates by looking up records dynamically in a spreadsheet database.
- Observed behavior
- The user wants to input a specific client number in Word and have the corresponding client information automatically populated from an Excel data source, replacing manual data entry.
Ensure your Excel dataset is organized with clear column headers (e.g., Client Number, Name, Email) in the first row with no blank rows above it. If you plan to use VBA UserForms, make sure macros are enabled in your Word Trust Center settings.
Use Word Mail Merge for Bulk or Simple Auto-Population
Mail Merge is a built-in feature that connects a Word document to an Excel dataset, allowing you to easily insert standard merge fields for names, emails, and client numbers.
While Mail Merge is traditionally used for bulk document generation, it can be filtered to produce a single document for a specific client number. Note that once you complete the merge, the final document becomes static and is no longer connected to the Excel data source.
Open your Excel workbook, ensure all columns have descriptive headers like 'Client Number' and 'Name', and save the file.
Open your Word template, go to the 'Mailings' tab, click 'Select Recipients', choose 'Use an Existing List', and browse for your saved Excel workbook.
Place your cursor where you want the data to appear in the template, click 'Insert Merge Field' on the Mailings tab, and select the corresponding column headers.
Click 'Edit Recipient List' to filter by a specific client number. Once selected, click 'Preview Results' to verify the data, then click 'Finish & Merge' to generate the completed document.

Create a VBA UserForm for Dynamic Client Number Lookups
If you need an interactive prompt where users can directly type a client number into Word to fetch specific records on the fly, a VBA UserForm is the most flexible approach.
Auto-Populate Templates Using WPS Office
WPS Writer fully supports Mail Merge and VBA macros, allowing you to effortlessly connect spreadsheets to document templates for quick, automated client data entry.
- 1. Open your template: Launch WPS Writer and open the document you wish to use as your base template.
- 2. Connect the data source: Navigate to the 'Mailings' tab and click 'Open Data Source' to load your WPS Spreadsheet containing the client data.
- 3. Insert fields: Use the 'Insert Merge Field' button to add placeholders for your client information.
- 4. Merge to document: Filter for the client number you need, then click 'Merge to New Document' to generate the populated file instantly.

Frequently Asked Questions
Why does my completed Mail Merge document lose connection to the Excel file?
Once you click 'Finish & Merge', the software generates a new, static document containing the final text to prevent unintended overwrites. The original template file remains connected to the Excel file, but the generated output does not.
Can I pull Excel data into Word without using Mail Merge or VBA?
Yes, you can copy specific cells in Excel, switch to Word, and choose 'Paste Special' > 'Paste Link'. This inserts the data as a Linked Object, meaning any changes made in Excel will automatically update in Word.
Why aren't my VBA macros running in my Word template?
Macros are often blocked by default security settings. Go to File > Options > Trust Center > Trust Center Settings > Macro Settings, and ensure macros are enabled. Additionally, make sure you have saved the document as a Macro-Enabled Template (.dotm) rather than a standard .docx file.




