# Import Records

## Overview

With Labii's import function, you can create and update records for multiple columns in bulk.

{% embed url="<https://youtu.be/_yR4umzXqEg>" %}

## File preparation for import

### **File format**

* **\*.tsv**, or **\*.xlsx** file is supported. \*.csv is not allowed because **,** is used as separate for multiple choose.
* **\*.xlsx** file will only use data from the first sheet.

### **Import file template**

Import templates are not required for the import. Labii is capable of reading any tabular file. Columns can be selected for import, as well as for where they should be imported.

For the preparation of the import document, please follow these guidelines:

1. The first row serves as the title.
2. To ignore a row, use **#** at the beginning.
3. The Unique IDs (UIDs) are used as a means of matching and updating existing records. If there are any UIDs that do not match, they will be ignored and a new UID will be generated. In the event that you create records by mistake, you can reuse existing UIDs.
4. If you would like more information on how to prepare data for a particular column, please refer to the Import value of each column widget.
   1. For the **MultiSelect** or **ForeignKeys** widget, use **,** to separate multiple values.
   2. Use UID or name for **ForeignKey** widget.
   3. If a column is using **Boolean** widget, use **true** if it is true and **false** if it is false.
   4. Use **YYYY-MM-DD** for **Date** widget. This column can be configured to display the date in a different format.
5. It is important to use the same column name as that of the workflow action table when preparing data for workflow.
   1. To separate values for multiple workflow action items, use the `,` symbol. As an example, you might want to use `10,20` in order to create two aliquots with a volume of 10 and 20, respectively.
      1. It should be noted that if only one value is provided, all workflow items will use the same value. As an example, you could use `10` to create two aliquots of the same volume that are created by the workflow.
   2. If you want to get the numeric id in order, use the `{{INDEX}}`. As an example, use A`{{INDEX}}` in order to create storage coordinates for two aliquots that have been segregated into `A1` and `A2`.
   3. If you would like to get letter IDs in order, use `{{LETTERINDEX}}`. Acceptable range: A to ZZ

The file will be processed locally and will not be uploaded to the server. You should ensure that your data has been successfully imported before deleting it.

## How to use

The import function is only available in the [table list view](/user-guide/list-view/table-list-view.md). Click the **Import** button in the table list view to begin importing.

{% stepper %}
{% step %}
**Select file**

During the importing process, the first step is to select a file that you wish to import. The projects that are going to be assigned also need to be specified.

If the title row is located in a row other than the first, kindly indicate the row number where the title row can be found. Once you provide this number, all rows preceding the title row will be disregarded.

![](/files/nvEHbQzkOxXjVzlpI6dp)

**Workflows**

After the import has been completed, select workflows to be executed. Use this field if you want to create 5 vials when a sample is created.
{% endstep %}

{% step %}
**Match file headers**

Once clicked Submit button, you will be directed to the second step of importing: match file headers with column names.

![](/files/6VQ2I02glUdiPNUz6Afr)

This form allows you to specify which fields to import and where they should be imported. Every field in the list represents a header from the file provided. The dropdown menu represents the columns defined in Labii.

To import the value from the file into a particular column, choose an option from the dropdown menu. The options with the same header as the file will be selected, so please review the headers to ensure all are correct.

* To disregard a column to be imported, select **Do not import** or leave it empty.
* The **UID** must be included and selected if you want to update existing records.
* You can select **Metadata** multiple times; all headers will be included.
* To pass data to the workflow, you can select **Workflow data** multiple times.

{% hint style="info" %}
**Required Fields for New Records**: When importing new records, ensure that all required fields (marked with an asterisk \* in the table settings) are included in your import file. If any required fields are missing, the import will fail for those records. Review your table's column configuration in the admin guide to identify which columns are marked as required.
{% endhint %}
{% endstep %}
{% endstepper %}

## Execute workflows after importing

Workflows can be executed after the import has been completed. Use this function if you want to create 5 vials when a sample is created.

1. [You can create one or more workflows.](/admin-guide/workflows.md) You do not need to include any triggers.
2. If you need to create multiple records within a workflow, prepare columns with "," to separate values.
   1. The column title must match the column name.
   2. Use "`,`" to separate values for multiple workflow actions. In the case where only one value is provided, it will be applied to each workflow action item.
   3. For foreignKey replacement, use UID.
   4. To replace the serial number, you can also use `{{INDEX}}` or `{{LETTERINDEX}}`.
   5. To create a serial of storage coordinates, "`A1,A2,A3`" is identical to "`A{{INDEX}}`".
3. Choose one or more workflows to execute at the first step of importing
4. To pass the column to workflow actions, select Workflow data in step 2.

## Update existing records

Using the import function, you can also update multiple columns for multiple records at the same time. You only need to match the UID column with the UID field to enable it to work.

If you happen to import the same batch of data twice by mistake, you can use the UIDs of the duplicated records with the new imports, and the new records will use the old UIDs from the previous import.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.labii.com/user-guide/list-view/import.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
