dolt table export test > example.csv
command exports the test
table to example.csv
. Test has 3 rows and two columns.export.csv
file on your computer. Click Import, make sure the preview is correct, click Load and the Dolt table should be loaded in as a new sheet.dolt sql -r csv -q <query> > export.csv
.dolt sql-server
. This command starts a MySQL compatible server on port 3306 with a user named root
. It exposes a database named after the Dolt repository directory with dashes (-
) changed to underscores (_
). Thus, dolt-test
directory name becomes dolt_test
database name. For the purposes of this example I am running a database named dolt_test
with user dolt
.Control Panel
> Administrative Tools
> ODBC Data Sources
or just search for ODBC Data Sources
. You'll be greeted by this window:Add...
and you should see MySQL ODBC 8.0 ANSI Driver
and MySQL ODBC 8.0 Unicode Driver
, select the MySQL ODBC 8.0 ANSI Driver
and click Finish
. Now you need to enter your connection information. We call the data source Dolt Test, leave the server on TCP and enter localhost
as the server name, enter the user dolt
, and the database as dolt_test
. After entering that information, clicking Test
should result in a Connection Successful
dialog. Click OK
and the new Dolt Test ODBC connector will appear in the list.Data
> Get Data
> From Other Sources
> From ODBC
. Pick Dolt Test
from the drop down and click OK
. This will bring up the following preview screen where you can navigate to and pick the table you want to import. The test table is in the dolt_test
database. Clicking Load
will load the data into the selected sheet.Data
> Get Data
> From Other Sources
> From ODBC
. Pick Dolt Test
from the drop down and click Advanced
instead of OK
. Enter the SQL query you would like to run in the text box. This currently does not work for some versions of Excel because of a Dolt issue. Until this is resolved, if you want to import the results of a query instead of a full table we recommend dolt sql -r csv -q
and using the CSV instructions of this document.File
> Export
> Change File Type
> CSV (Comma delimited)
. Then click Save as
. Name the CSV and place it wherever you'd like on your filesystem. For the purposes of this example, we called the CSV Sheet1.csv
and placed it in the dolt-test
directory that houses the Dolt database.dolt table import
command with the table and CSV file path as arguments.-r
or replace. You have two options on import for an existing table, -u
for update or r
for replace. -u
does not delete any existing rows. So, essentially it only adds or updates existing rows. r
makes the table look exactly like what is in the CSV. I generally use -r
on most imports.dolt table import -c
. c
stands for create.CREATE TABLE
statement and processing it through dolt sql
or you can have Dolt give you a hint by running dolt schema import --dry-run
.UNSIGNED
and NOT NULL
constraints from test_col
. Once you have the schema you want, process the CREATE TABLE
statement through dolt sql
and complete the import by running dolt table import -r
.dolt add -A
and dolt commit
. To send that commit to DoltHub, set up DoltHub as a remote and run dolt push
.dolt table export test > example.csv
command exports the test
table to example.csv
. Test has 3 rows and two columns.File
> Open
, select the Upload tab, and either drag the example.csv
file into the web browser window or Select a file from your device
using the operating system's file system browser. Click OK
and the Dolt table should be loaded in as a sheet named after the CSV filename.dolt sql -r csv -q <query> > export.csv
.dolt sql-server
. This command starts a MySQL compatible server on port 3306 with a user named root
. It exposes a database named after the Dolt repository directory with dashes (-
) changed to underscores (_
). Thus, dolt-test
directory name becomes dolt_test
database name. For the purposes of this example I am running a database named dolt_test
with user dolt
.ngrok
is a hosted service that allows you to open a port on your computer to the internet fairly painlessly. First follow the ngrok installation instructions for your operating system. Then run ngrok tcp 3306
(or substitute 3306 for whichever port you started the sql-server on). This will start a program with the following output in your terminal:ngrok.io
host is open and forwarding traffic through a secure tunnel to a host on your machine. In the above case the ngrok
host is named 0.tcp.ngrok.io
and the port is 15612
. You can connect to your running Dolt sql-server from anywhere on the internet with this host and port.Tools
> Script Editor
. You will be greeted by a new browser tab with an empty editor.server
, dbName
, username
, password
, port
, query
, and sheetName
with your desired inputs. When run using the "play icon", this script will clear the contents of the sheet sheetName
and insert the results of your query.File
> Download
> Comma separated values (.csv, current sheet)
. This will make a CSV file in your default download location named <Spreadsheet name> - <Sheet Name>.csv;
.dolt table import
command with the table and CSV file path as arguments.-r
or replace. You have two options on import for an existing table, -u
for update or r
for replace. -u
does not delete any existing rows. So, essentially it only adds or updates existing rows. r
makes the table look exactly like what is in the CSV. I generally use -r
on most imports.dolt table import -c
. c
stands for create.CREATE TABLE
statement and processing it through dolt sql
or you can have Dolt give you a hint by running dolt schema import --dry-run
.UNSIGNED
and NOT NULL
constraints from test_col
. Once you have the schema you want, process the CREATE TABLE
statement through dolt sql
and complete the import by running dolt table import -r
.dolt add -A
and dolt commit
. To send that commit to DoltHub, set up DoltHub as a remote and run dolt push
.dolt sql-server
and expose a port to the internet as described in "Reading from Dolt Using SQL JDBC Connector". Once that is complete, we again use the Script Editor in Google Sheets. Open a script editor, using Tools
> Script Editor
and paste in the following code:dolt sql-server
is running in and run dolt diff
or dolt sql -q "select * from test"
and you should see the values of the sheet in the database.dolt add test
and dolt commit
.