---
metadata:
  - name: generator
    content: Diplodoc Platform v5.63.0
alternate:
  - en/operations/connection/create-file
  - ru/operations/connection/create-file
  - href: en/operations/connection/create-file.md
    type: text/markdown
    title: Markdown version
csp:
  - script-src:
      - https://mc.yandex.ru
    img-src:
      - https://mc.yandex.ru
    connect-src:
      - https://mc.yandex.ru
      - wss://mc.yandex.ru
    child-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-ancestors:
      - 'blob:'
      - https://mc.yandex.ru
canonical: en/operations/connection/create-file.html
title: How to create a connection to a file in DataLens On-premises
description: Follow this guide to create a connection to a file.
vcsPath: en/operations/connection/create-file.md
---

# Creating a connection to a file

To create a connection to a file:

1. Select a workbook for the new connection and click **Create** → **Connection**.
1. Under **Files and services**, select the **Files** connection.
1. Click **Upload files** and select the file. Information about this file and the data to upload will appear at the center of the screen.

   {% note info %}

   * Currently, you can upload CSV, TXT, and Excel (`xlsx` only) files.
   * The number of files per connection cannot exceed 10. Each Excel sheet is counted as a separate file.
   * The size of each file may not exceed 200 MB.
   * The maximum number of columns per file is 300.
   * After you upload the file, only the first 30 rows are previewed.

   {% endnote %}

1. Select the file upload parameters:

   {% list tabs %}

   - CSV or TXT

     1. Information about this file and the data to upload will appear at the center of the screen. At the top of the screen, select:

        * **Encoding**: Specify the file data encoding. The available values are `utf-8`, `utf-16`, `windows-1251`, and `utf-8-sig`.
        * **Delimiter**: Specify the delimiter used in the file. The available values are `Comma`, `Semicolon`, and `Tabulation character`.
        * **Column header**: Select the header option. If you select **Yes**, DataLens will use the first row of data as a header.

     1. Optionally, select the type of data for each column. To do this, click the icon to the left of the column name.

   - Excel

     1. If your file contains multiple sheets, specify the ones you want to upload in the **Add sheets** window. You cannot select empty sheets. Enable the **Sheets** option to select all available sheets. Each sheet is uploaded to a separate table.
     1. Information about this file and the data to upload will appear at the center of the screen. At the top of the screen, select the **Column header** option. If you select **Yes**, DataLens will use the first row of data as a header.

   {% endlist %}

1. Repeat steps 3 and 4 to add files.
1. Click **Create connection**.


1. Select the [workbook](../../workbooks-collections/index.md) to save your connection to or create a new one. If using legacy folder navigation, select a folder to save the connection to. Click **Create**.


1. Enter a name for the connection and click **Create**.

You can add, rename, [replace](#file-replace), and delete existing files in the connection.

## Additional settings {#additional-settings}

<!-- source: en/_includes/datalens/operations/datalens-file-connection-export-settings.md -->
You can limit data export from charts based on this connection. To do this, click <!-- diplodoc:svg ![icon](../../_assets/console-icons/gear.svg) --><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M7.199 2H8.8a.2.2 0 0 1 .2.2c0 1.808 1.958 2.939 3.524 2.034a.2.2 0 0 1 .271.073l.802 1.388a.2.2 0 0 1-.073.272c-1.566.904-1.566 3.164 0 4.069a.2.2 0 0 1 .073.271l-.802 1.388a.2.2 0 0 1-.271.073C10.958 10.863 9 11.993 9 13.8a.2.2 0 0 1-.199.2H7.2a.2.2 0 0 1-.2-.2c0-1.808-1.958-2.938-3.524-2.034a.2.2 0 0 1-.272-.073l-.8-1.388a.2.2 0 0 1 .072-.271c1.566-.905 1.566-3.165 0-4.07a.2.2 0 0 1-.073-.27l.801-1.389a.2.2 0 0 1 .272-.072C5.042 5.138 7 4.007 7 2.199c0-.11.089-.199.199-.199M5.5 2.2c0-.94.76-1.7 1.699-1.7H8.8c.94 0 1.7.76 1.7 1.7a.85.85 0 0 0 1.274.735 1.7 1.7 0 0 1 2.32.622l.802 1.388c.469.813.19 1.851-.622 2.32a.85.85 0 0 0 0 1.472 1.7 1.7 0 0 1 .622 2.32l-.802 1.388a1.7 1.7 0 0 1-2.32.622.85.85 0 0 0-1.274.735c0 .939-.76 1.7-1.699 1.7H7.2a1.7 1.7 0 0 1-1.699-1.7.85.85 0 0 0-1.274-.735 1.7 1.7 0 0 1-2.32-.622l-.802-1.388a1.7 1.7 0 0 1 .622-2.32.85.85 0 0 0 0-1.471 1.7 1.7 0 0 1-.622-2.32l.801-1.389a1.7 1.7 0 0 1 2.32-.622A.85.85 0 0 0 5.5 2.2m4 5.8a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0" clip-rule="evenodd"/></svg> at the top right and uncheck **Allow data export**. With this option disabled, for charts based on the respective connection, the export data option will not be available in their <!-- diplodoc:svg ![icon](../../_assets/console-icons/ellipsis.svg) --><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M3 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M9.5 8a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m5 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" clip-rule="evenodd"/></svg> menu. However, you will still be able to copy chart data and take screenshots.
<!-- endsource: en/_includes/datalens/operations/datalens-file-connection-export-settings.md -->

## File replacement {#file-replace}

To update the connection data, replace a file:

1. In the row with the file name, click <!-- diplodoc:svg ![image](../../_assets/console-icons/ellipsis.svg) --><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M3 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M9.5 8a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m5 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" clip-rule="evenodd"/></svg> → **Replace** and specify your file. After the file is uploaded, the updated data will be displayed at the center of the screen.
1. Click **Save changes**. This will update the data for all datasets and chats built based on this connection.

{% note tip %}

For dynamic data, you can use other sources, e.g., [ClickHouse®](./create-clickhouse.md).

{% endnote %}


<!-- source: en/_includes/clickhouse-disclaimer.md -->
_ClickHouse® is a registered trademark of [ClickHouse, Inc](https://clickhouse.com)._
<!-- endsource: en/_includes/clickhouse-disclaimer.md -->