MotherDuck

Section header image mobile

MotherDuck is a cloud-native analytics platform powered by DuckDB, designed for fast, scalable data analysis. Coefficient's MotherDuck integration lets you easily connect to your MotherDuck instance and import data into Google Sheets or Excel. You can import data from your tables or run custom SQL queries to retrieve exactly the information you need.

Need help writing a query? Coefficient's GPT SQL Builder can generate and refine SQL queries, making it easier to explore and analyze your MotherDuck data directly from your spreadsheet. 🦆

Connecting to MotherDuck

Import from MotherDuck

Import from Tables & Columns

Import using a Custom SQL Query

Import from GPT SQL Builder

SQL Editor Features

Schedule your Import, Snapshots, and Add Automations

FAQs for MotherDuck Integration

Connecting to MotherDuck

When you begin a MotherDuck import for the first time, you will need to go through a few steps to connect MotherDuck as a data source for Coefficient.

1. Open the Coefficient Sidebar and click the Menu.

2. Select “Connected Sources”.

Connected Sources2.png

3. Select “Add Connection” at the bottom and then “Connect” to MotherDuck.

4. Generate an API Key for your account in MotherDuck. 

ℹ️ NOTE: If an API Key is not yet created for your account, you will need to create one. 
Log in to MotherDuck UI > Click your organization name in the top left, then select Settings > Click Create token, enter a name, and choose the token type > Copy the token.

Please see MotherDuck's API documentation for the full guide.

5. Enter the token generated from your MotherDuck account and click Connect.

6. When successful, you can proceed with creating an import by clicking the "Import data..." button at the bottom.

Import from MotherDuck

There are a few ways to import data from MotherDuck using Coefficient: importing from tables and columns, importing from a custom SQL query, and importing with the GPT SQL Builder.

Importing from tables and columns lets you create imports without writing SQL. Using a custom SQL query gives you additional flexibility in the data you import into Coefficient. And with the GPT SQL Builder, you can prompt Coefficient's AI to automatically build the SQL query for you.

Import from Tables & Columns

1. Open the sidebar and select “Import from…”.

ImportFrom....png

2. Select “MotherDuck” from the list.

 

3. Choose "From Tables & Columns".

4. The Import Preview window opens, showing all the table schemas from your MotherDuck database. Select the table for your import (eg. ”test_datasheet”), then click Next. 

5. Once the table is selected, the fields within that table will appear in a list on the left side of the Import Preview window. Select the fields you want to include in your import by checking/unchecking the corresponding boxes.
ℹ️ NOTE: The Import Preview shows only a sample of your data (50 rows). This sample data will be updated if there are any changes to the import's criteria.

6. Customize your import by adding filters, sorts, limits, or even grouping the data into a cloud pivot table. Then "Import" when done.

7. Congratulations on your first MotherDuck import using Tables & Columns! 🎉

Import using a Custom SQL Query

1. Open the sidebar and select “Import from…”.

ImportFrom....png

2. Select “MotherDuck” from the list.

3. Select "Custom SQL Query".

 

4. The Import Preview window opens, allowing you to enter your custom SQL query in the text box shown below. For further flexibility, you can use Coefficient’s SQL Parameters feature to point a value to a specific cell/range of cells for your query.

ℹ️  NOTE: Whenever you make changes to your query, you need to click "Refresh Preview" to update the sample data shown in the preview window.

5. When you click “Import,” you will be prompted to give your import a name. The name MUST be UNIQUE as it will also be the name of the tab in your Google Sheets/Excel when imported. (You can always change the name later if needed).

6. Congratulations on your successful MotherDuck Custom SQL import with Coefficient! 🎉

Import from GPT SQL Builder

1. Open the sidebar and select “Import from…”.

ImportFrom....png

2. Select “MotherDuck” from the list.

3. Select "Custom SQL Query".

4. Enter your prompt/query in the "Describe what you want to query" box. (Example: "Show me all the information from the 'movies' table.") When done, click "Generate SQL". 

 â„ąď¸Ź PRO TIP: Be specific when entering your prompts so that the AI can easily understand your requirements and provide more accurate results.

5. The SQL Builder will automatically generate and write the SQL query for you in the blue text box.

ℹ️  NOTE: Click "Refresh Preview" to display a sample of your data results (only 50 rows are shown) or to update the results of the preview if you make any changes to the query. 

6. You will be prompted to give your import a name. Remember, it MUST be UNIQUE as it will also be the name of the tab in your Google Sheets/Excel when imported. (You can always change the name later if needed).

7. Congratulations on your first MotherDuck import using Coefficient's GPT SQL Builder!  🎉 

SQL Editor Features

The SQL Editor — including both Custom SQL and the GPT SQL Builder — offers a familiar, intuitive experience with features designed to enhance usability and closely mirror native SQL tools.

Autocomplete Query

Provides helpful suggestions (keywords, table names, fields, etc.) as you type your query. 

 

Undo / Redo Query

Return/revert query changes during the import preview session.

 

Inline Data Preview

Preview changes from the import preview window as you modify the query.

 

Query Formatting

Arrange queries in a more readable format with a simple right-click.

 

Run Keys Shortcut

Allows Command + Enter to run queries.

 

In-place Parameter Referencing

Parameters can be called from the query.

 

Schedule your Import, Snapshots, and Add Automations

Once you have pulled your data into your spreadsheet using Coefficient, you can set up the following:

1. Schedule your Import

Screenshot 2025-09-16 at 8.02.41 AM.png

2. Turn on Snapshots

Screenshot 2025-09-16 at 7.20.51 AM.png
Screenshot 2025-09-16 at 7.20.58 AM.png

3. Set Up Automations

Screenshot 2025-09-16 at 7.22.00 AM.png

FAQs for MotherDuck Integration

Does Coefficient stay connected to my MotherDuck database?

When Coefficient needs to run a query, it establishes a connection to your database, runs the query on your behalf, and terminates the connection once the query completes.

I added a table (or column) to my MotherDuck database — why isn't it showing up in Coefficient?

To deliver a snappy experience when you set up imports from MotherDuck, we cache your database schema for up to 24 hours. If you recently changed your database schema (e.g., added, renamed, or removed a table/column) and don't see the change reflected in Coefficient, you can force a schema reload:

  1. Open the Coefficient sidebar in Google Sheets or Excel.
  2. Click the ≣ menu in the top right of the sidebar, then click "Connected Sources."
  3. Click your MotherDuck connection to open its Connection Settings page.
  4. Click the ︙ button near the top right, choose "Reload Schema," and click "Reload" on the confirmation dialog.

 

Was this article helpful? 0 out of 0 found this helpful