Merging Data into a Word Document

advertisement
Merging Data into a Word Document
Importing data into a spreadsheet
You need a data source to start with. Usually this is in the form of an Excel spreadsheet, but you
may receive data in a flat file format. A flat file is all the data strung together as plain text with
fields separated by a delimiter character, like a comma, semicolon or tab.
Name,Date,Room
Jones,1/21/97,17
Smith,4/17/03,24
Brown,,24
This is an example of a flat file with data in comma-delimited format. This file type may
sometimes be referred to as a comma-separated-value or CSV file. The first line contains the
field names, and the next lines contain the records, where there is one piece of data for each
field. In the third record there is no date available, so the two commas are right next to each
other to indicate no data.
When you are given data like this, you must first import it into a spreadsheet. Open Excel and
select Data- Import External Data- Import Data-. In the Select Data Source window, select the
file that contains your data.
Like I said, the data are usually delimited. It is very rare that data are given to you in a file
where the fields are just aligned in columns. Click Next.
In Step 2, check the box to indicate what kind of delimiter your data uses. In this case, a comma.
As soon as you do this, the data will line up in columns.
Step 3 allows you to set data types for the spreadsheet fields, but this is usually not necessary if
you are going to use the spreadsheet for merging purposes. Click Finish. Excel will ask where
you want to put the data. Just click OK.
Now you have the data in the spreadsheet. Row 1 contains the field labels.
Setting up the Word Document
Open Microsoft Word. Compose your letter, considering where you intend to place the data
from the merge fields. This could be almost anything, but normally includes names, addresses
and dates.
Once the letter is ready to go, you next need to establish a connection between the letter and the
data. If you intend to use the data and letter again in the future, it is critical that you save the
letter and the data source (spreadsheet) to sensible locations and then not move them. Changing
their locations later will break this connection. Just create a folder in you’re My Documents
folder and save it all there.
Back to the Word Document. You should have a toolbar for merging data. It looks like this:
If you don’t have this, go to View- Toolbars- and click on Mail Merge.
Click on the second button in the toolbar. It is the Open Data Source button. Choose the
spreadsheet you saved earlier, and specify which sheet contains the data (usually the first one).
Once you do this, all the buttons on the bar change from grayed out to active.
You can now start inserting merge fields into your document. The sixth button on the bar is the
Insert Merge Fields button. Position your cursor where you want to insert a merge field and
click the button.
You will be presented with a list of fields from your data source. You can insert fields one at a
time (insert a field, close the Insert Merge Field box, reposition the cursor, and insert additional
fields) or just insert a bunch at once (in the case of an address block).
The Merge Fields will look like text, but can be treated as discrete objects that can be moved
around or deleted. They should be separated by spaces and punctuation – imagine how it’s going
to look once the data is merged.
When you have all the merge fields set up the way you want, it’s time to save the document in
case something bad happens in the subsequent merge.
Now you are ready to actually merge the data. You can merge all the records in the data source,
or choose recipients. To choose a subgroup of recipients, click on the third button on the toolbar
– the Mail Merge Recipients button.
You can check or uncheck the boxes on the left to add or subtract records from the data that is
going to get merged to your document. Click OK.
The final step for merging is to click on one of the three buttons at the far right of the Merge
Toolbar. These are Merge to New Document, Merge to Printer, and Merge to Email.
Merge to New Document creates a new document (imagine that) that has a number of pages
equal to the number of records you merged. Your original merge template is still open
underneath. This merged document can be edited, saved, printed or whatever. Merge to Printer
just sends it immediately to a printer. Merge to Email will use email addresses contained in the
data source (if there are any) to compose emails with the merged document as the body of the
message. You must specify a subject line, and you must have Outlook open before you trigger
this.
That’s all there is to a document merge.
Merging to envelopes and labels
Doing envelopes and labels is pretty straightforward, but is easier to do in the Mail Merge
Wizard.
Envelopes
Open a new blank Word Document. Click on Tools- Letters and Mailings- Mail Merge. On the
right of the window you will see the six-step merge wizard. Choose Envelopes as the type of
document you are working on. Click Next. Click Envelope Options.
Here you get to specify the envelope size or type. Click OK.
Compose the return address in the upper left corner of the envelope if necessary. Then click in
the general area of the address location on the envelope. You will get a gray outline for the
address block:
Now open your data source like you did for the document above.
When you are ready to insert the Address Block, click on the Insert Address Block button (the
fourth button on the merge toolbar) and Click OK. One item of importance here – Word will do
a good job of matching the fields you declared in the Excel Spreadsheet if you gave them
obvious names – like Last Name, Address1, Address2, City and so on. Word will insert a field
called <<AddressBlock>> in the envelope.
Click Next. You get a chance to select recipients if need be. Click Next. In Step 4 you can add
Postal Bar Code and that sort of thing. Click Next. Step 5 is a preview, and Step 6 completes
the merge ready for printing.
Labels
Labels work more or less the same way. Go to Tools- Letters and Mailings- Mail Merge.
Choose Labels from the wizard. When you click Label Options you get a list of the most
common label types with product numbers for manufacturers:
Once you have chosen the label type, open your data source and insert your address block. Click
next. Select recipients in step 3 if necessary. In step 4 you must click the Update All Labels
button to replicate the layout across all the labels on the sheet. Preview the sheets in step 5 and
complete the merge in step 6. Then print the labels.
Easy, wasn’t it?
Download