Mail Merge in LibreOffice Writer with a Database
Mail merge in LibreOffice Writer allows you to quickly create personalized documents, such as letters, labels, and emails, by automatically pulling recipient information from a connected database or spreadsheet. This guide provides a step-by-step walkthrough for connecting your data source, inserting dynamic merge fields into your document, and generating the final personalized output.
Step 1: Prepare Your Data Source
Before beginning in Writer, ensure your data is organized properly.
1. Create a spreadsheet (using LibreOffice Calc, Microsoft Excel, or a
CSV file) or an actual LibreOffice Base (.odb) database. 2.
Place column headers in the first row (e.g., First_Name,
Last_Name, Address, Email). 3.
Fill in the recipient data below the headers and save the file.
Step 2: Register the Database in LibreOffice
LibreOffice requires your data file to be registered as an accessible data source. 1. Open LibreOffice Writer. 2. Go to Tools > Options (or LibreOffice > Preferences on macOS). 3. In the left panel, expand LibreOffice Base and select Databases. 4. Click the New… button under the Registered Databases section. 5. Click Browse…, select your spreadsheet or database file, and click Open. 6. Give the database a recognizable name in the Registered name field and click OK, then click OK again to close the Options window.
Step 3: View the Data Source in Writer
- In LibreOffice Writer, press F4 (or go to View > Data Sources).
- The Data Sources panel will appear above your document workspace.
- Expand your registered database name, then expand Tables, and select Sheet1 (or your specific table). Your data records will display in the grid.
Step 4: Insert Fields into Your Document
- Write the standard text for your letter or document in the main editor.
- To insert a dynamic field, click and hold a column header from the Data Sources grid above, then drag and drop it into the desired position in your document.
- Alternatively, place your cursor where the data should go, navigate to Insert > Field > More Fields…, switch to the Database tab, select Mail merge fields, choose your database and column, and click Insert.
- Add spaces and punctuation around the inserted fields (e.g.,
<First_Name> <Last_Name>,).
Step 5: Preview and Complete the Mail Merge
- Go to File > Print.
- A prompt will appear stating: “Your document contains address database fields. Do you want to print a form letter?” Click Yes.
- In the Mail Merge dialog that appears:
- Records: Choose to merge All records or specify a custom range.
- Output: Choose Printer to send documents directly to your printer, or choose File to save the merged output.
- If saving to a file, decide whether to save as a single large document containing all pages or as separate individual documents for each recipient.
- Click OK to generate your merged documents.