<p>The <b>Mail Merge</b> feature is used to create a set of documents combining a common content which is taken from a text document and some individual components (variables, such as names, greetings etc.) taken from a spreadsheet (for example, a customer list). It can be useful if you need to create a lot of personalized letters and send them to recipients.</p>
<p>To start working with the <b>Mail Merge</b> feature in the <ahref="https://www.onlyoffice.com/en/document-editor.aspx"target="_blank"onclick="onhyperlinkclick(this)"><b>Document Editor</b></a>,</p>
<li><b>Prepare a data source and load it to the main document</b>
<ol>
<li>A data source used for the mail merge must be an <b>.xlsx</b> spreadsheet stored on your portal. Open an existing spreadsheet or create a new one and make sure that it meets the following requirements.
<p>The spreadsheet should have a header row with the column titles, as values in the first cell of each column will designate merge fields (i.e. variables that you can insert into the text). Each column should contain a set of actual values for a variable. Each row in the spreadsheet should correspond to a separate record (i.e. a set of values that belongs to a certain recipient). During the merge process, a copy of the main document will be created for each record and each merge field inserted into the main text will be replaced with an actual value from the corresponding column. If you are goung to send results by email, the spreadsheet must also include a column with the recipients' email addresses.</p>
<li>Open an existing text document or create a new one. It must contain the main text which will be the same for each version of the merged document. Click the <b>Mail Merge</b><imgalt="Mail Merge icon"src="../images/mailmergeicon.png"/> icon on the <b>Home</b> tab of the top toolbar.</li>
<li>The <b>Select Data Source</b> window will open. It displays the list of all your <b>.xlsx</b> spreadsheets stored in the <b>My Documents</b> section. To navigate between other <b>Documents</b> module sections, use the menu on the left part of the window. Select the required file and click <b>OK</b>.</li>
<li>Click the <b>Edit recipients list</b> button on the top of the right sidebar to open the <b>Mail Merge Recipients</b> window, where the content of the selected data source is displayed.
In the opened window, you can add new information, edit or delete the existing data if necessary. To simplify working with data, you can use the icons at the top of the window:
<ul>
<li><imgalt="Copy"src="../images/copy.png"/> and <imgalt="Paste"src="../images/paste.png"/> - to copy and paste the copied data</li>
<li><imgalt="Undo"src="../images/undo1.png"/> and <imgalt="Redo"src="../images/redo1.png"/> - to undo and redo undone actions</li>
<li><imgalt="Sort Lowest to Highest icon"src="../images/sortatoz.png"/> and <imgalt="Sort Highest to Lowest icon"src="../images/sortztoa.png"/> - to sort your data within a selected range of cells in ascending or descending order</li>
<li><imgalt="Filter icon"src="../images/sortandfilter.png"/> - to enable the filter for the previously selected range of cells or to remove the applied filter</li>
<li>
<imgalt="Clear Filter icon"src="../images/clearfilter.png"/> - to clear all the applied filter parameters
<pclass="note"><b>Note</b>: to learn more on how to use the filter, please refer to the <b>Sort and filter data</b> section of the <b>Spreadsheet Editor</b> help.</p>
</li>
<li>
<imgalt="Search icon"src="../images/searchicon.png"/> - to search for a certain value and replace it with another one, if necessary
<pclass="note"><b>Note</b>: to learn more on how to use the Find and Replace tool, please refer to the <b>Search and Replace Functions</b> section of the <b>Spreadsheet Editor</b> help.</p>
<li>Place the mouse cursor where the merge field should be inserted, click the <b>Insert Merge Field</b> button on the right sidebar and select the necessary field from the list. The available fields correspond to the data in the first cell of each column of the selected data source. All the required fields can be added anywhere.
<li>Turn on the <b>Preview results</b> switcher on the right sidebar to view the text with the merge fields replaced with actual values from the data source. Use the arrow buttons to preview the versions of the merged document for each record.
<li>To delete an inserted field, disable the <b>Preview results</b> mode, select the field with the mouse and press the <b>Delete</b> key on the keyboard. </li>
<li>To replace an inserted field, disable the <b>Preview results</b> mode, select the field with the mouse, click the <b>Insert Merge Field</b> button on the right sidebar and choose a new field from the list.</li>
<li>Select the merge type. You can start mass mailing or save the result as a PDF or Docx file to print or edit it later. Select the necessary option from the <b>Merge to</b> list:
<p><imgalt="Merge type selection"src="../images/mergeto.png"/></p>
<ul>
<li><b>PDF</b> - to create a single PDF document that includes all the merged copies that can be printed later</li>
<li><b>Docx</b> - to create a single Docx document that includes all the merged copies that can be edited individually later</li>
<li>
<b>Email</b> - to send the results to recipients by email
<pclass="note"><b>Note</b>: the recipients' email addresses must be specified in the loaded data source and you need to have at least one email account connected in the <b>Mail</b> module on your portal.</p>
<li>Choose all the required records to be applied:
<ul>
<li><b>All records</b> (this option is selected by default) - to create merged documents for all records from the loaded data source</li>
<li><b>Current record</b> - to create a merged document for the record that is currently displayed</li>
<li>
<b>From</b> ... <b>To</b> - to create merged documents for a range of records (in this case you need to specify two values: the number of the first record and the last record in the desired range)
<pclass="note"><b>Note</b>: the maximum allowed quantity of recipients is 100. If you have more than 100 recipients in your data source, please, perform the mail merge by stages: specify the values from 1 to 100, wait until the mail merge process is over, then repeat the operation specifying the values from 101 to N etc.</p>
<li>click the <b>Download</b> button to save the file on your PC. You'll find the downloaded file in your default <em>Downloads</em> folder.</li>
<li>click the <b>Save</b> button to save the file on your portal. In the opened <b>Folder for save</b> window, you can change the file name and specify the folder where you want to save the file. You can also check the <b>Open merged document in new tab</b> box to check the result when the merge process is finished. Finally, click <b>Save</b> in the <b>Folder for save</b> window.</li>
<li>If you've selected the <b>Email</b> option, the <b>Merge</b> button will be available on the right sidebar. After you click it, the <b>Send to Email</b> window will open:
<p><imgalt="Send to Email window"src="../images/sendtoemail.png"/></p>
<li>In the <b>From</b> list, select the required mail account if you have several accounts connected to the <b>Mail</b> module.</li>
<li>In the <b>To</b> list, select the merge field corresponding to the email addresses of the recipients if this option was not selected automatically.</li>
<li>Enter your message subject in the <b>Subject Line</b> field.</li>
<li>Select the mail format from the list: <b>HTML</b>, <b>Attach as DOCX</b> or <b>Attach as PDF</b>. When one of the two latter options is selected, you also need to specify the <b>File name</b> for attachments and enter the <b>Message</b> (the text of your letter that will be sent to recipients).</li>