---
sidebar_position: 0.9
title: From Your Local Machine
description: Moving data from local to MotherDuck through the UI or programmatically.
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## Single file

<Tabs>

<TabItem value="CLI" label="CLI">

Using the CLI, you can connect to MotherDuck, create a database, and load a single local file (JSON, Parquet, CSV, etc.) to a MotherDuck table.


First, connect to MotherDuck using the `ATTACH` command.

```sql
ATTACH 'md:';    
```

Create a cloud database (or point to any existing one) and load a local file into a table.

```sql
CREATE DATABASE test01;
USE test01;
CREATE OR REPLACE TABLE orders as SELECT * from 'orders.csv'; 
```

</TabItem>

<TabItem value="UI" label="UI">

In the MotherDuck UI, you can add JSON, CSV or Parquet file directly using the **Add data** button in the top left of the UI.
See the [Getting Started Tutorial](../../../getting-started/e2e-tutorial/part-2#loading-your-data) for details.

</TabItem>
</Tabs>

## Multiple files or database

To upload multiple files at once, or data in other formats supported by DuckDB, you can use the DuckDB CLI or any other supported [DuckDB client](https://duckdb.org/docs/data/multiple_files/overview.html).

<Tabs>
<TabItem value="CLI" label="CLI">

If your all your files reside from a single table, you can use the [glob syntax to load all files into a single table](https://duckdb.org/docs/data/multiple_files/overview.html).

For example, to load all CSV files from a directory into a single table, you can use the following SQL command:

```sql
ATTACH 'md:';    
CREATE DATABASE test01;
USE test01;
CREATE OR REPLACE TABLE orders as SELECT * from 'dir/*.csv'; 
```

If your files are in different formats or you want to load them into different tables, you can first load the files into different tables in a local DuckDB database and then copy the entire database into MotherDuck.

To copy the entire local DuckDB database into MotherDuck, you can use the following SQL commands:

```sql
ATTACH 'md:';    
```

```sql
ATTACH 'local.ddb';
CREATE DATABASE cloud_db from 'local.ddb';    
```

</TabItem>
</Tabs>
