# How to use File mappings

## Navigating to File mappings

You can find File mappings through Settings -> File mappings in the Struct PIM sidebar.

Clicking 'File mappings' will present you with an overview of all file mappings currently in the system.

To create a new File mapping click the green "Create new"-button in the top-right corner.

## Setting up the basics

Having clicked "Create new" you are presented with the 'Create file mapping'-page.

We start by setting up the basics, like name, type of the entity you wish to import and an optional description.

Next we have the option of limiting the file mapping to only certain user groups by adding them under 'Availability'. In this tutorial we have elected to allow all user groups to use the file mapping.

<figure><img src="https://3609403033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZJAMIKVcqchSDbt4A7DE%2Fuploads%2FCM9qp941xVLNtqJSYCXw%2Fimage.png?alt=media&#x26;token=f7f48263-ded1-4dd7-868f-af77d1ee1c17" alt=""><figcaption><p>Create file mapping</p></figcaption></figure>

You can choose to enable 'Use fallbacks' if you want empty localized or segmented values to fallback and finally you can choose the direction for the import/export.

For direction you have three options:

* Import - This file mapping only works when importing
* Export - This file mapping only works when exporting
* Import/Export - This file mapping works for importing and exporting.

For this tutorial we only want the file mapping to work when importing.

## Setting up the mappings

Under 'Fields mapping' you can click the "Add field"-button to add a field mapping, this field represents the mapping of a column to an [attribute](https://docs.struct.com/pim3/fundamental-concepts/attributes) in the PIM. You can add as many as you wish.

<figure><img src="https://3609403033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZJAMIKVcqchSDbt4A7DE%2Fuploads%2FZtuEFtqFua7sEzbHs8Jc%2Fimage.png?alt=media&#x26;token=8094c896-1e89-49a1-8227-5e9f9d7958b2" alt=""><figcaption><p>Fields mapping with one column to attribute field added</p></figcaption></figure>

For this tutorial we need three fields.&#x20;

The 'Field name'-field represents the name of a column in the excel spreadsheet and the 'Map to PIM field'-field represents an [attribute](https://docs.struct.com/pim3/fundamental-concepts/attributes) in the PIM.&#x20;

The excel spreadsheet we are using in this tutorial has the headers 'ProductName', 'Brand' and 'Price'. They map to 'ProductName', 'Brand (en-GB)' and 'Price DKK' respectively.

<figure><img src="https://3609403033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZJAMIKVcqchSDbt4A7DE%2Fuploads%2FYnfhXjxYwfkqLVmpZ9RI%2Fimage.png?alt=media&#x26;token=34dad2b4-bcdc-43a0-91d2-3ac0567a8fc8" alt=""><figcaption><p>Fields mapping with three columns and mapping filled in</p></figcaption></figure>

Having finished the mapping, you need to choose one or more keys. These key(s) will act as keys to match existing entities in the system. If the key(s) match a [product](https://docs.struct.com/pim3/fundamental-concepts/products-and-variants) in the system, that [product](https://docs.struct.com/pim3/fundamental-concepts/products-and-variants) will be updated with the data from the excel spreadsheet.

You have now created a file mapping. To finalize the creation click the "Save changes"-button in the bottom-right corner now to save your file mappings.

{% hint style="info" %}
**Custom Excel template** is only for exporting, so it is not relevant for this tutorial.
{% endhint %}

## Where do I find my file mappings when importing

Next time you import entities for which you have a File mapping, you can click "Load mapping" on the data mapping page.&#x20;

<figure><img src="https://3609403033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZJAMIKVcqchSDbt4A7DE%2Fuploads%2FLSXmhXQltKFF1AcBCClI%2Fimage.png?alt=media&#x26;token=157df6ea-7c33-4b18-a324-486fc22a02ff" alt=""><figcaption><p>Data mapping page</p></figcaption></figure>

This will reveal a dropdown showing all of the file mappings available to you. Choose your File mapping in the dropdown and click "Load".

<figure><img src="https://3609403033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZJAMIKVcqchSDbt4A7DE%2Fuploads%2FXHmqhWDYZNLc0NNIQ2ri%2Fimage.png?alt=media&#x26;token=183a022b-f7e1-49a8-b558-0474314cbb47" alt=""><figcaption><p>Data mapping - loading File mapping</p></figcaption></figure>

Now your File mapping is loaded and you can cherish the time you saved mapping and click "Next" to continue importing.
