> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.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-fix-nav-issues/-5HsuqGEaVjyHCfx/images/cloud/migrate/csv_01.png?fit=max&auto=format&n=-5HsuqGEaVjyHCfx&q=85&s=d42a4cadb195e135ae5abc86fa2be5a7" 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-fix-nav-issues/-5HsuqGEaVjyHCfx/images/cloud/migrate/csv_02.png?fit=max&auto=format&n=-5HsuqGEaVjyHCfx&q=85&s=5e672156414ef3435bf484dccac4f629" 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-fix-nav-issues/-5HsuqGEaVjyHCfx/images/cloud/migrate/csv_03.png?fit=max&auto=format&n=-5HsuqGEaVjyHCfx&q=85&s=4edf3be7ef038ff5e9245b431f788c8d" 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-fix-nav-issues/-5HsuqGEaVjyHCfx/images/cloud/migrate/csv_04.png?fit=max&auto=format&n=-5HsuqGEaVjyHCfx&q=85&s=d83e0e292b5d1bbdef596e2acf2760f8" 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-fix-nav-issues/-5HsuqGEaVjyHCfx/images/cloud/migrate/csv_08.png?fit=max&auto=format&n=-5HsuqGEaVjyHCfx&q=85&s=985235e47a14eb6817da999553c0d989" 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-fix-nav-issues/-5HsuqGEaVjyHCfx/images/cloud/migrate/csv_05.png?fit=max&auto=format&n=-5HsuqGEaVjyHCfx&q=85&s=85b79e5b6bbac6507d60eecadaedcbb2" 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-fix-nav-issues/-5HsuqGEaVjyHCfx/images/cloud/migrate/csv_06.png?fit=max&auto=format&n=-5HsuqGEaVjyHCfx&q=85&s=410497858879eb4741331d47821fb898" 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-fix-nav-issues/-5HsuqGEaVjyHCfx/images/cloud/migrate/csv_07.png?fit=max&auto=format&n=-5HsuqGEaVjyHCfx&q=85&s=1aea6619d50484e34bd7d80af1301919" 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-fix-nav-issues/-5HsuqGEaVjyHCfx/images/cloud/migrate/csv_09.png?fit=max&auto=format&n=-5HsuqGEaVjyHCfx&q=85&s=36bbcc00ff7509af67320f78414b993f" 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-fix-nav-issues/-5HsuqGEaVjyHCfx/images/cloud/migrate/csv_10.png?fit=max&auto=format&n=-5HsuqGEaVjyHCfx&q=85&s=ab057cf126b4da19f4d9d7dbd0214336" alt="upload_file_11" width="1260" height="262" data-path="images/cloud/migrate/csv_10.png" />
  </Step>
</Steps>
