> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-home-button.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload files to Cloud

> Learn how to upload files to Cloud

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

ClickHouse Cloud provides an easy way to import your files and supports the
following formats:

| Format                          |
| ------------------------------- |
| `CSV`                           |
| `CSVWithNamesAndTypes`          |
| `CSVWithNames`                  |
| `JSONEachRow`                   |
| `TabSeparated`                  |
| `TabSeparatedWithNames`         |
| `TabSeparatedWithNamesAndTypes` |

<Steps>
  <Step>
    <h2 id="upload-file">
      Upload a file
    </h2>

    From the Cloud homepage, select your service as shown below:

    <Image img="https://mintcdn.com/private-7c7dfe99-home-button/q-fyjp7bh9TLY82A/images/cloud/migrate/csv_01.png?fit=max&auto=format&n=q-fyjp7bh9TLY82A&q=85&s=876c101d2a4ffec4d0f30bcc50b6b18d" alt="upload_file_02" width="3024" height="1483" data-path="images/cloud/migrate/csv_01.png" />

    If your service is idle you will need to wake it.

    Select `Data sources` in the left hand tab as shown below:

    <Image img="https://mintcdn.com/private-7c7dfe99-home-button/q-fyjp7bh9TLY82A/images/cloud/migrate/csv_02.png?fit=max&auto=format&n=q-fyjp7bh9TLY82A&q=85&s=eae61a72498dac03087820fcd7866993" alt="upload_file_03" width="3024" height="1483" data-path="images/cloud/migrate/csv_02.png" />

    Next select `Upload a file` on the right side of the data sources page:

    <Image img="https://mintcdn.com/private-7c7dfe99-home-button/q-fyjp7bh9TLY82A/images/cloud/migrate/csv_03.png?fit=max&auto=format&n=q-fyjp7bh9TLY82A&q=85&s=408100744de84bcd3b4f8391a4a54aa2" alt="upload_file_04" width="3024" height="1483" data-path="images/cloud/migrate/csv_03.png" />

    A file dialogue will pop up allowing you to select the file that you wish to
    use to insert data into a table on your Cloud service.

    <Image img="https://mintcdn.com/private-7c7dfe99-home-button/q-fyjp7bh9TLY82A/images/cloud/migrate/csv_04.png?fit=max&auto=format&n=q-fyjp7bh9TLY82A&q=85&s=622103a5187dd8c3729a90ceb85e4a22" alt="upload_file_05" width="1267" height="736" data-path="images/cloud/migrate/csv_04.png" />
  </Step>

  <Step>
    <h2 id="configure-table">
      Configure table
    </h2>

    Once the file has uploaded you will be able to configure the table where you want
    to insert the data to. A preview of the table with the first three rows is shown.

    <Image img="https://mintcdn.com/private-7c7dfe99-home-button/q-fyjp7bh9TLY82A/images/cloud/migrate/csv_08.png?fit=max&auto=format&n=q-fyjp7bh9TLY82A&q=85&s=cc1ba1bd8209db5bd4a25f974fac1c40" alt="upload_file_08" width="3018" height="1476" data-path="images/cloud/migrate/csv_08.png" />

    You can now select a destination table. The options are:

    * a new table
    * an existing table

    <br />

    You can specify which database you want to upload the data to, and in the case of
    a new table, the name of the table that will be created. You will also be able to select the sorting key:

    <Image img="https://mintcdn.com/private-7c7dfe99-home-button/q-fyjp7bh9TLY82A/images/cloud/migrate/csv_05.png?fit=max&auto=format&n=q-fyjp7bh9TLY82A&q=85&s=09c759f82ac150dee12226c61f9d45a1" alt="upload_file_05" width="3016" height="1474" data-path="images/cloud/migrate/csv_05.png" />

    Columns read from the file are shown as `Source field`s and for each field, you
    can change:

    * the inferred type
    * the default value
    * whether to make the column [Nullable](/reference/data-types/nullable) or not

    <Image img="https://mintcdn.com/private-7c7dfe99-home-button/q-fyjp7bh9TLY82A/images/cloud/migrate/csv_06.png?fit=max&auto=format&n=q-fyjp7bh9TLY82A&q=85&s=2fd6a98d8e07c65848538ec4b9e16b29" alt="upload_file_06" width="3012" height="1476" data-path="images/cloud/migrate/csv_06.png" />

    <Info>
      **Excluding fields**

      You can also remove a field if you don't want to include it in the import
    </Info>

    You can specify the type of table engine that you want to use:

    * `MergeTree`
    * `ReplacingMergeTree`
    * `SummingMergeTree`
    * `Null`

    <br />

    You can specify a partitioning key expression and primary
    key expression.

    <Image img="https://mintcdn.com/private-7c7dfe99-home-button/q-fyjp7bh9TLY82A/images/cloud/migrate/csv_07.png?fit=max&auto=format&n=q-fyjp7bh9TLY82A&q=85&s=42d42b33b5c6a4de019bef72b5878e96" alt="upload_file_07" width="3004" height="1476" data-path="images/cloud/migrate/csv_07.png" />

    Click `Import to ClickHouse` (shown above) to import the data. The data import will be queued as
    indicated by the `queued` status badge in the `Status` column as shown below. You can also click
    `Open as query` (shown above) to open the insert query in the SQL console. The query will insert
    the file which was uploaded to an S3 bucket using the `URL` table function.

    <Image img="https://mintcdn.com/private-7c7dfe99-home-button/q-fyjp7bh9TLY82A/images/cloud/migrate/csv_09.png?fit=max&auto=format&n=q-fyjp7bh9TLY82A&q=85&s=97d94291457c576c6820c6181c43d1d5" alt="upload_file_09" width="1271" height="487" data-path="images/cloud/migrate/csv_09.png" />

    If the job fails you will see a `failed` status badge under the `Status` column of
    the `Data upload history` tab. You can click `View Details` for more information
    on why the upload failed. You may need to modify the table configuration or clean
    the data based on the error message for the failed insert.

    <Image img="https://mintcdn.com/private-7c7dfe99-home-button/q-fyjp7bh9TLY82A/images/cloud/migrate/csv_10.png?fit=max&auto=format&n=q-fyjp7bh9TLY82A&q=85&s=ca10845ec20085918db626ad44a1776d" alt="upload_file_11" width="1260" height="262" data-path="images/cloud/migrate/csv_10.png" />
  </Step>
</Steps>
