> ## Documentation Index
> Fetch the complete documentation index at: https://help.csvbox.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Send imports to Azure Blob Storage

> Write every CSVbox import to a container in your Azure Storage account as a CSV file, authenticated with a container SAS token.

The Azure Blob Storage destination writes every import to a container in your Azure Storage account as a single CSV file. CSVbox authenticates with a shared access signature (SAS) token, so you don't share your storage account key.

## Before you start

You need:

* An Azure Storage account and a container in it.
* A **SAS token** for the container with these permissions:
  * **List**, so **Test Connection** can check access to the container.
  * **Create** and **Write**, so CSVbox can upload files.

Create the token in the Azure portal: open the container, go to **Shared access tokens**, choose the permissions and an expiry date, and click **Generate SAS token and URL**. Copy the **Blob SAS token**.

> [!WARNING]
>
> When the SAS token expires, imports to this destination fail. Choose an expiry date that suits you, and replace the token before it expires.

## Set up the destination

**1. Select Azure Blob Storage as the destination**

Open your importer, go to the **Destination** tab and choose **Azure Blob Storage**.

**2. Enter your storage details**

Fill in all three fields:

| Field | Value |
| - | - |
| **Storage Account Name** | The storage account name only, for example `mycompanystorage`. |
| **Container Name** | The container name, for example `imports`. |
| **BLOB SAS Token** | The SAS token, starting with `sv=`. Don't include a leading `?`. |

**3. Test the connection**

Click **Test Connection**. A check icon and **Connection Successful** mean CSVbox can reach the container. **Invalid Credentials.** means the account, container or token is wrong, or the token doesn't allow listing the container.

The fields accept `{{variable}}` placeholders filled from the importer's [environment variables](https://help.csvbox.io/advanced-installation/environment-variables.md), for example to write each customer's imports to their own container.

## File names

Each import is saved in the root of the container as `<file name>.csv`.

* By default, the file name is `<import id>_<user id>`, for example `9368_default123`. If you don't pass a user ID, the name ends with `_`.
* To choose the name, pass `target_file_name` in the importer options, or in `import.options` of the [REST File API](https://help.csvbox.io/advanced-installation/rest-file-api.md). Pass the name without an extension: `.csv` is always added, so `report.csv` becomes `report.csv.csv`.

A file with the same name as an existing blob replaces it. Use a name that changes with every import to keep a history.

## What is written

* One CSV file per import, encoded in UTF-8 with a byte order mark so Excel opens it correctly.
* The first row holds the column names, and the remaining rows hold the data.
* [Unmapped columns](https://help.csvbox.io/sheet-settings/import-steps/map-columns.md#accept-unmapped-columns) are included only for files sent through the [REST File API](https://help.csvbox.io/advanced-installation/rest-file-api.md). Imports made in the importer widget contain the mapped columns only.

When the file is written, the import is marked **Success** with all rows counted as delivered. If the upload fails, the whole import is marked **Failed**. The error is shown in the import's error log on the [Imports](https://help.csvbox.io/dashboard-settings/imports.md) page. Failed uploads aren't retried, so import the file again after fixing the problem.

## Changing or copying the destination

To change the account, container or token, edit the fields and click **Test Connection** again. The credentials are stored encrypted.

Copying an importer copies its Azure Blob Storage destination, including the SAS token.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.