# Linking to Excel Inserts

## Overview

As described in the [**Excel Inserts**](https://help.taglo.io/excel-inserts-and-outputs/excel-inserts) help sections, you can connect custom Excel sheets to your generated Model, either by creating [**Outputs**](https://help.taglo.io/excel-inserts-and-outputs/excel-outputs) from your Model, or by linking [**Assumptions**](https://help.taglo.io/assumptions) to your Inserts - this page deals with the second of these.

{% hint style="info" %}
Generally, we advise against linking Assumptions to Excel Inserts if it can be avoided. If your inputs are produced by a dynamic Excel model, you will not be able to control this model from within the [**Model Editor**](https://help.taglo.io/models/model-editor), and there's usually a way to produce whatever inputs you need in Models!
{% endhint %}

## Linking to Insert inputs

Assumptions are linked to Inserts via [**Named Ranges**](https://support.microsoft.com/en-us/office/define-and-use-names-in-formulas-4d0f13ac-53b7-422e-afd2-abd7ff379c64). You will need to create a Named Range in your Insert that represents your input data, and then tell Models how to link to that Named Range.

The following example illustrates this process.

### Example link to Excel Insert

In this example, we have some input data for the `New members per month` Variable that we want to take from a custom Excel sheet, as shown below. The input data is in a 3x2 table, with one `Membership type` per row, and one `Region` per column. This input sheet is contained in an Excel Insert that we have already created, called `Volume Input`. To make the input data accessible from Models, we must assign a Named Range to it: in this case, we have given it the name `Input_NewMembersPerMonth`.

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FyEveNG0afSO7eg3mi7iI%2Fimage.png?alt=media&#x26;token=3a9b7d04-05c4-437d-8083-d410546bfb60" alt="Section of an Excel spreadsheet, used as an Excel Insert in Models. A range of cells to be used as an input has been assigned as an Excel Named Range"><figcaption><p><strong>Excel Insert</strong> with input data</p></figcaption></figure>

To link our data to this input, we select and Edit the relevant Assumptions, as shown below.

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FVqC5mrFBYoATOmypH1rG%2Fimage.png?alt=media&#x26;token=dd774943-4e92-42bc-822f-d5ae11dd191a" alt="Screenshot of the Assumptions list, with several assumptions selected, highlighting the Edit button in the preview panel"><figcaption><p>Editing Assumptions</p></figcaption></figure>

This opens an **Assumptions dialog**. First, we change the source type to `Link to Excel Insert` (1), which results in several additional steps being shown. In the **Link to Insert** step, we choose the `Volume Input` Insert <mark style="color:green;">**(2)**</mark>, and the `Input_NewMembersPerMonth` Named Range <mark style="color:green;">**(3)**</mark>.

{% hint style="warning" %}
Before this point, you should ensure that the linked workbook is not open in Excel, so that Models can successfully access information about its Named Ranges.
{% endhint %}

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2F06gmlYtm3UUH9X7bgG9D%2Fimage.png?alt=media&#x26;token=d2f0f157-2ee6-46e8-8566-1d6d3c13642c" alt=""><figcaption><p><strong>Assumptions dialog</strong>: Linking to Excel Insert</p></figcaption></figure>

Once you have selected a Named Range, you then need to give Models information about the shape of the data in that Named Range. You do this by matching the layout of data in the input workbook to the displayed table in Models. In the example below, we drag the `Region` [**Dimension**](https://help.taglo.io/dimensions) to the Horizontal section <mark style="color:green;">**(4)**</mark>, which results in the correct table configuration <mark style="color:green;">**(5)**</mark>.

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FoUzC8QKJoRsqJjMRLsr3%2Fimage.png?alt=media&#x26;token=c955883f-a8a0-4d2f-8ed4-5214640756b8" alt="Screenshots showing how to manipulate Dimensions to correctly link to Excel Insert data inputs"><figcaption><p><strong>Assumptions dialog:</strong> Matching shape of input data</p></figcaption></figure>

Finally, we need to enter some default values for the data <mark style="color:green;">**(6)**</mark>, so that Models can calculate its values when it does not have access to the Excel Insert (Models will not extract data from the input workbook when re-calculating the Model). Note that in the example below, we have arranged the table with `Region` on the horizontal axis so that we can copy and paste data directly from the input workbook.

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FVOYsfpsjWs5P3DLDOjBf%2Fimage.png?alt=media&#x26;token=0440baaf-224d-44c5-a9a8-ddc05fa4a6a2" alt="Screenshot showing Default Values page of Assumptions dialog. The user has entered values to use when the Excel Insert input is not available." width="563"><figcaption><p><strong>Assumptions dialog:</strong> Entering default values</p></figcaption></figure>
