Document Editing Problems

Fix Word Mail Merge SQL Query Error Caused by Excel Filters

WPS Content ManagerWPS Content Manager Oct 12, 2026 870 views

Question details

The user needs to resolve an SQL string parsing error that prevents a Word mail merge from correctly importing data from an Excel worksheet to generate labels.

How to Fix Word Mail Merge SQL Query Errors from Excel
Product
Word, Excel
Device & OS
not provided
Scenario
Generating document labels via Word mail merge using an Excel spreadsheet as the linked data source.
Observed behavior
The mail merge process fails and triggers an error message stating, "Word could not parse your query options into a valid SQL string," which happens when filters are active in the source Excel file.
Before you start

Verify that your source Excel spreadsheet has a clear, continuous header row at the very top, and remove any merged cells or entirely blank columns before attempting to link the data.

Solution 1Recommended

Clear All Active Filters in the Excel Source Worksheet

This removes hidden data constraints in the spreadsheet that interrupt Word's ability to run the database query required for the mail merge.

When an Excel worksheet has active filters, the data range presented to Word can become disjointed. This prevents Word's internal SQL engine from properly parsing the records, leading to the query error.

1
Open the Data Source

Open the Excel workbook that contains the data you are trying to merge.

2
Clear Active Filters

Navigate to the 'Data' tab on the Excel ribbon. Click on the 'Clear' button in the Sort & Filter group to remove any applied filters and display all hidden rows.

3
Save and Close

Save the changes to the workbook and close Excel completely to release the file lock.

4
Reconnect Data Source

Reopen your Word document, go to the 'Mailings' tab, click 'Select Recipients', choose 'Use an Existing List', and reconnect the newly saved Excel file.

Clear All Active Filters in the Excel Source Worksheet
File Closure Requirement: Always ensure the Excel file is fully closed before running the mail merge in Word to avoid read-only restrictions and connectivity failures.
Effortless Mail Merge with WPS Office

Perform Error-Free Mail Merges with WPS Writer

Bypass complex SQL parsing errors by using WPS Writer to seamlessly merge data from WPS Spreadsheets into your letters, emails, or labels.

  1. 1. Launch Mail Merge: Open your template document in WPS Writer and navigate to the 'References' or 'Mailings' tab, then click 'Mail Merge'.
  2. 2. Connect Spreadsheet: Click 'Open Data Source' and select your saved WPS Spreadsheets (.xlsx) file containing the recipient list.
  3. 3. Insert Fields: Place your cursor in the document where the data should appear, and click 'Insert Merge Field' to add the corresponding column data.
  4. 4. Complete the Merge: Click 'Merge to New Document' or 'Merge to Printer' to instantly generate your finalized labels or letters.
Intuitive step-by-step Mail Merge wizard for labels and letters.Seamless and stable data linking between WPS Writer and WPS Spreadsheets.Fully compatible with Microsoft Word (.docx) and Excel (.xlsx) file formats.Free, lightweight, and fast office suite for daily document tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Word say it cannot parse query options into a valid SQL string?

This error is triggered when the connected Excel data source contains active filters, hidden rows, or invalid column headers, which prevent the word processor from successfully querying the spreadsheet's database.

Can I perform a mail merge while my Excel data source is open?

It is highly recommended to save and completely close your Excel spreadsheet before linking it to a document. Leaving it open can cause file-locking conflicts, leading to read-only errors or failed data connections.

How do I disconnect a problematic Excel data source from my document?

To detach the data source, go to the Mailings tab, click 'Start Mail Merge', and select 'Normal Word Document'. This removes the link to the spreadsheet and converts your file back to a standard document.

Does the data source need to be on the first sheet of the Excel workbook?

While the software will usually prompt you to select a specific sheet, keeping your primary mailing list on the very first sheet of the workbook with clear text headers reduces the chance of mapping and query errors.