> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.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-mintlify-8c05c8a2/edZyd8dUn5NVy-Ij/images/cloud/migrate/csv_01.png?fit=max&auto=format&n=edZyd8dUn5NVy-Ij&q=85&s=e7ef142b62b28784d68a41ab25d0e0f1" 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-mintlify-8c05c8a2/edZyd8dUn5NVy-Ij/images/cloud/migrate/csv_02.png?fit=max&auto=format&n=edZyd8dUn5NVy-Ij&q=85&s=4659e9a015ee322777d1add67c71fe12" 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-mintlify-8c05c8a2/edZyd8dUn5NVy-Ij/images/cloud/migrate/csv_03.png?fit=max&auto=format&n=edZyd8dUn5NVy-Ij&q=85&s=455347ba794a3a584f6c52c1b4908e3c" 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-mintlify-8c05c8a2/edZyd8dUn5NVy-Ij/images/cloud/migrate/csv_04.png?fit=max&auto=format&n=edZyd8dUn5NVy-Ij&q=85&s=dafef7d16c30377e715475f33a4ee3d9" 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-mintlify-8c05c8a2/edZyd8dUn5NVy-Ij/images/cloud/migrate/csv_08.png?fit=max&auto=format&n=edZyd8dUn5NVy-Ij&q=85&s=6d10e1d71fec22d51f371c9528ac4a0e" 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-mintlify-8c05c8a2/edZyd8dUn5NVy-Ij/images/cloud/migrate/csv_05.png?fit=max&auto=format&n=edZyd8dUn5NVy-Ij&q=85&s=c6a713c62462cb631d0e9310e83aee19" 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-mintlify-8c05c8a2/edZyd8dUn5NVy-Ij/images/cloud/migrate/csv_06.png?fit=max&auto=format&n=edZyd8dUn5NVy-Ij&q=85&s=ed6ec59b2f59f5161a4e864964125812" 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-mintlify-8c05c8a2/edZyd8dUn5NVy-Ij/images/cloud/migrate/csv_07.png?fit=max&auto=format&n=edZyd8dUn5NVy-Ij&q=85&s=00ba2fcc7b4e26d1a67b36bdf9b6def5" 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-mintlify-8c05c8a2/edZyd8dUn5NVy-Ij/images/cloud/migrate/csv_09.png?fit=max&auto=format&n=edZyd8dUn5NVy-Ij&q=85&s=3bc81f3a946c14d34329b29e113c57fd" 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-mintlify-8c05c8a2/edZyd8dUn5NVy-Ij/images/cloud/migrate/csv_10.png?fit=max&auto=format&n=edZyd8dUn5NVy-Ij&q=85&s=2a79c9b56cef0b7bc09aaa1f8709ab19" alt="upload_file_11" width="1260" height="262" data-path="images/cloud/migrate/csv_10.png" />
  </Step>
</Steps>
