Fix Word Mail Merge SQL Query Error Caused by Excel Filters
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.

- 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.
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.
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.
Open the Excel workbook that contains the data you are trying to merge.
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.
Save the changes to the workbook and close Excel completely to release the file lock.
Reopen your Word document, go to the 'Mailings' tab, click 'Select Recipients', choose 'Use an Existing List', and reconnect the newly saved Excel file.

Verify and Format Excel Column Headers
Fixing invalid column names or unsupported characters ensures the merge fields can be properly identified by the word processor.
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. Launch Mail Merge: Open your template document in WPS Writer and navigate to the 'References' or 'Mailings' tab, then click 'Mail Merge'.
- 2. Connect Spreadsheet: Click 'Open Data Source' and select your saved WPS Spreadsheets (.xlsx) file containing the recipient list.
- 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. Complete the Merge: Click 'Merge to New Document' or 'Merge to Printer' to instantly generate your finalized labels or letters.

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.




