How to Link Excel to Word Using Repeating Sections

Generate Word sections from Excel table rows using Repeating Sections in the Excel-to-Word Document Automation Add-in. Learn how to link and automatically update documents with your latest Excel data.

See Transcript

In this tutorial, we will cover how to set up repeating sections in Excel and Word, which is a key feature included in the Excel-to-Word Document Automation add-in. This tutorial assumes that you are familiar with how to link and update content using the add-in. We'll walk through the two-step setup and update workflows: the initial one-time setup and the ongoing updates you can make any time after that.

Let's start with the one-time setup. First, prepare your Excel data table and name it, then submit the content to Word. Next, in Word, design your template section and link the content to your Excel items. Once the links are in place, create the repeating section. After that initial setup, updating is quick. Anytime your source data changes in Excel, click ‘Submit’ and then click ‘Update Document’ in Word. The template section is then copied for each row in the Excel table, and the linked content in Word refreshes automatically.

I'll start out by showing you how to set up this basic text product catalog, and I'll first demonstrate the end result. After the Excel table and Word template are set up, you submit content from your Excel table, click ‘Update Document’ in Word, and the system generates a section for each row in the Excel document table while updating the content. To prepare and name your Excel table for text links, create an Excel data table and organize your data so each row equals one section. Row one contains the column headers, and these item names become the link names you reference in Word or PowerPoint. Rows two and below contain your actual data, with one section's worth of content per row.

This simple example only contains three text items for the columns in each section: item name, description, and price. Then, name the table. The name must start with your prefix plus ‘RS_’ plus your table name—in this example, r_RS_catalog’. Then, click ‘Submit’ to make the content available to Word. In Word, I’ll show you how to design your template section, link content, and create the section, look at your section template. In this simple example, there are three lines of text, though it could be one line, one page, or an entire chapter. On the link tab of the add-in, click ‘Get Excel Content’.

Then, we'll link the Word content in the section to the repeating section columns submitted from Excel. The names of the repeating section items from the Excel table are derived from the repeating section table name plus an underscore plus the column name. In this example, the table name is ‘r_RS_catalog’. I want to place the product name here, which is named ‘item_name’. I select that column name from the drop-down and click ‘Insert Content / Update Link’, which surrounds the content in an invisible content control that links it to the first column in the Excel table. I'll also link the description and the price. You can also link content to items not in repeating section tables; for example, I could add a link for the customer name, which stays the same for all section copies.

Now that I'm done designing my section template, I'll create the repeating section by selecting all the content in the template section. I'll then choose the section from the ‘Select Repeating Section’ drop-down and click ‘Create Section’. The content is wrapped in a content control named ‘repeating section:’ plus the table name. Also helpful are ‘List Repeating Sections’, which shows a list of valid sections in the Word document, and ‘Reset Sections’, which removes any copies of the section template. Do this reset before making edits to your template so you don't inadvertently modify the section copies.

Now that our repeating section is set up, we can update the content at any time by simply clicking ‘Submit’ in Excel and then ‘Update’ in Word. The add-in deletes any prior section copies, makes new copies of the section template (one for each row), and updates the content. If I then add 30 rows of new data—for example, if you import new data for the next catalog—you can sort, filter, and use the auto-hide rows feature, then click ‘Submit’ and ‘Update’ you see that the sections have been updated.

The previous example only updated text, but repeating sections can also update other content types, including HTML content, images, and tables. This next example contains data for three sections but has seven items for each section. To show you the end result, I'll ‘Submit’ from Excel and then ‘Update’ in Word. We can see that it updates two text items, some HTML content, three images, and a table in each of the three sections.

Next, I’ll explain how to set up each of the content types. The content type is indicated by a label directly above the column, and there are seven valid content type labels. The first two columns are text, text is the default content format. If there is no label, then the content type is text. Text can appear anywhere in your Word document and can be formatted any way you want.

The next column is an example of HTML content. A wide variety of HTML tags and styles are supported, making this a very powerful feature, and the HTML can be created dynamically using formulas and other automation means.

The next three columns show three different methods of updating images. The first is an in-cell image, meaning that you place the image within the Excel cell. You can also use Excel's image formula to make the image appear from a URL. The second method, ‘Image URL’, inserts the image directly into your Word or PowerPoint document from a URL that must be publicly accessible, which avoids large file transfers from Excel. The third method, ‘Image Name’, contains the name of an image shape in Excel; for example, a cylinder image named ‘r_cylinder’ matches the shape name in the column.

The ‘Table’ content type transfers a named range or data table and inserts it into the Word document. For example, this range is named ‘r_CylRange’. In this example, the ranges are formatted as flex tables, so they have a similar formatting appearance in Word and PowerPoint as they do in Excel.

The type label of the last column is ‘Ignore’, meaning it will not be transferred to Word, and these ignore columns can be used for reference or calculations.

I then ‘Submit’ the content to Word. In Word, on the link tab, I click ‘Get Excel Content’ and then I will link the items. Here, I will insert the section number, the shape name, and the HTML content here. You can see that the word ‘cylinder’ is bold based on a bold tag in the HTML. I'll insert the in-cell image here, the image URL here, the image name here, and the table here.

Now that my items are all linked, I will next select the entire section template and indicate that its source is the repeating section called ‘r_RS_shapes’ by selecting it from the list. Then, I'll click ‘Create Section’. Finally, I will click ‘Update Document’ in Word, and we can see that the add-in created the template copies and updated all of the content.

Next, try the examples in the sample content documents by checking out the repeating section sheet, and then you can set up repeating sections in your own documents. Thank you.

Learn more on our Repeating Sections Overview page.