Now you can create or replace tables in your database based on a table in Google Sheets or another table in your database. You can do this either via auto import, or by creating a new block and setting the Destination as "Database".
Via Auto Import
Auto import gives you a quick and simple option for importing tables in a Google Spreadsheet into your database. This video demonstrates how to do it, or follow the steps below.
- Go to the SeekWell Web App and hit cmd/ctrl "K" → "Import sheet to SQL".
- Choose your source Spreadsheet where it says "Spreadsheet" on the left. If you don't see it in the dropdown, start typing its name or click "Refresh Sheets".
- Choose your destination database on the right. If you haven't already, you will need to add your database as a source.
- Enter the table names you want your tables to be called to the right of their respective Sheets (by default, tables will be called their Sheet name). You can also uncheck any Sheets in the Spreadsheet that you don't want imported into your database. Then click "Import Sheets" on the bottom right.
- Double check that your new table was successfully created. It's that easy!
If you have gaps in your data (e.g. data in A:D, an empty column in E, and data F:G) then you will have to specify a range under the name of that Sheet.
Via a New Block with Database as Destination
You can also create a new database table by creating a new block and setting the Destination as "Database", which is demonstrated in the following video and also in the steps below.
1. Start a new block in the SeekWell Web App and choose the source of the data you want to create/replace a new table with. In this example I'm using a table from Google Sheets as my source data, so I'll choose "Sheets/CSV/Block" as my source.
2. Write SQL to fetch the data you want to use. If you want the entire table of your source data to be created/replaced in your destination database, simply SELECT * from your source table. If your source data is in a Google Sheet, remember to alias the Sheet in double curly braces, and change the Parameter Type to "Sheets" and enter your correct Spreadsheet and Sheet names under "Parameters" on the right.
3. Once you've checked the correct data is being returned in your SQL query, select "Database" as your destination, "Create/Replace" as your operation, and then choose the correct database you want to create/replace your new table in. Finally, enter the name of the table to be created/replaced (e.g. dummy.import_users).
If your destination database is Snowflake, the table name is case-sensitive so double check that your destination table name is correct!
4. Run the SQL and double check that your new table was created/replaced! If your source data changes often, you can set a schedule for replacing your new table (e.g. at weekly, daily, hourly intervals).
We currently only support creating / replacing tables. If you need the ability to "upsert" please contact us as this feature is currently in beta.