logo
search
Document Editing Problems

How to Create Formatted Text Lines from Excel or Word Tables

Chanuka GeekiyanageChanuka Geekiyanage Oct 26, 2026 868 views

Question details

The user needs to transform rows of table data (such as device names and IP addresses) into specific, formatted text sentences without manually copying and pasting values.

How to Create Formatted Text Lines from Excel or Word Table Data
Product
Word, Excel
Device & OS
not provided
Scenario
Generating command lines or structured sentences dynamically from tabular data.
Observed behavior
Instead of raw table cells, the desired output is a continuous list of strings where static text surrounds dynamic cell values from each row.
Before you start

Ensure your table has clear column headers (e.g., 'Name', 'IP Address', 'Network') and contains no merged cells, as this will prevent errors during the automated text conversion process.

Solution 1Recommended

Use Directory Mail Merge in Word

The most efficient way to generate customized sentences from a table is by using Word's Mail Merge feature set to the Directory document type.

A Directory Mail Merge allows you to create a continuous list of items on a single page, rather than generating a new page or document for every row in your table. This is perfect for compiling command lines or structured logs.

1
Start a Directory Merge

Create a blank Word document. Go to the 'Mailings' tab, click 'Start Mail Merge', and select 'Directory' from the dropdown menu.

2
Select your Data Source

Click 'Select Recipients' and choose 'Use an Existing List'. Browse your computer to locate and open the Excel or Word file containing your table.

3
Insert Text and Merge Fields

Type your static text into the document (e.g., 'allow ' and ' address '). Use the 'Insert Merge Field' button on the ribbon to place the corresponding variables between your text, resulting in a format like: allow {MERGEFIELD name} address {MERGEFIELD ip} register {MERGEFIELD network}.

4
Complete the Merge

Click 'Finish & Merge' and select 'Edit Individual Documents'. Choose 'All' and click 'OK' to generate your continuous list of formatted text lines.

Use Directory Mail Merge in Word
Continuous List Format: Using the 'Directory' option ensures all lines appear one after another instead of jumping to a new page per row.
Efficient Document Editing

Easily Transform Table Data into Text with WPS Office

WPS Office provides robust Mail Merge tools and advanced spreadsheet functions to seamlessly turn your tabular data into structured text lines. Highly compatible with Microsoft formats, it makes bulk data transformation effortless.

  1. 1. Prepare Data in WPS Spreadsheet: Open your data file in WPS Spreadsheet to ensure your columns are organized and headers are clearly labeled.
  2. 2. Start Mail Merge in WPS Writer: Create a new document in WPS Writer, navigate to the 'References' or 'Mailings' tab, and select 'Mail Merge'.
  3. 3. Connect and Insert Fields: Click 'Open Data Source' to connect your spreadsheet. Type your static text and use 'Insert Merge Field' to insert your table columns.
  4. 4. Generate Final Text: Click 'Merge to New Document' to output all your data rows as a continuous list of formatted text.
Seamless Mail Merge capabilities to convert table rows to custom text strings quickly.Full compatibility with Microsoft Word (.docx) and Excel (.xlsx) formats.Advanced formula support in WPS Spreadsheet for instant text concatenation.Free, lightweight, and features an intuitive tabbed interface for managing documents.
QA img-9

Frequently Asked Questions

Can I format table data into text without using Mail Merge?

Yes. If your data is in an Excel or WPS Spreadsheet, you can use the CONCATENATE function or the '&' symbol to stitch together static text strings and dynamic cell values into a single line.

Why is my Mail Merge outputting on separate pages instead of a single list?

This happens if you use the standard 'Letters' merge type instead of 'Directory'. Selecting 'Directory' (or 'Catalog' in older versions) ensures that each row's data is placed consecutively on the same page.

How do I deal with very complex text transformations?

For highly complex transformations, conditional logic, or massive data sets, writing a short script using Python (with libraries like pandas) or utilizing advanced Excel VBA macros might be more efficient than basic Mail Merge.