A step-by-step guide to connect your spreadsheets to a database in the cloud
A spreadsheet works well until several people need the same data, and then you end up with five copies of it and no idea which one is right.
Spreadsheets are a great way to start organizing data, especially small datasets with few relationships. A spreadsheet works well until several people need the same data, and then you end up with five copies of it and no idea which one is right.
As your data grows, a cloud-hosted database gives you one source of truth that applications, reports, and teammates can all use, with types and constraints that keep the data consistent. You don't have to give up spreadsheets, though. You can import your sheet into a database once, or connect the two so your team keeps working in the tools they know.
This article shows how to move spreadsheet data into MariaDB and PostgreSQL databases on Sevalla, and how to connect Google Sheets and Microsoft Excel to them. The SQL in this article was tested on MariaDB 12.3 and PostgreSQL 19 with the sample data below.
Prerequisites#
To follow along, you need:
- A spreadsheet to import. You can make a copy of our sample sheet, which has 768 rows of medical data in seven numeric columns.
- A Sevalla account to create the databases.
- For Google Sheets, the Coefficient add-on.
- For Excel, the Devart Excel Add-in for MySQL, which also works with MariaDB, and the Devart Excel Add-in for PostgreSQL. Both are paid add-ins for Excel on Windows, with a 30-day free trial.
Why connect spreadsheets to a database?#
A managed database service hosts, runs, backs up, and updates the database server for you, so you can work with your data without buying or maintaining hardware. Popular relational databases include:
- PostgreSQL: An open-source relational database known for its reliability, standards compliance, and extensions. It's a common choice for new applications and analytics.
- MySQL: The most widely used open-source relational database, especially for web applications.
- MariaDB: An open-source fork of MySQL, created by MySQL's original developers. It works with most MySQL tools and clients, which is why the MySQL connectors in this article also work with MariaDB.
Compared to a shared spreadsheet, a database gives you:
- One source of truth that every app, report, and person reads from.
- Data types and constraints that reject bad data, such as text in a number column or a missing required value.
- Access control, so people and apps get only the permissions they need.
- Backups and the ability to restore data after a mistake.
- Scale: databases handle millions of rows and many users at once, long after a spreadsheet slows down.
Prepare your spreadsheet data#
Spreadsheets are forgiving, and databases aren't. Before you import, clean up your data so it fits into a table:
- Use one header row with clear column names. Each column becomes a database column. Avoid spaces and special characters in names, and use one style, such as
BloodPressureorblood_pressure. - Keep one type of data per column. A column of numbers shouldn't contain text like "N/A" or "unknown", or the import fails or the value is lost.
- Decide how to handle empty cells. An empty cell usually becomes
NULL, or an empty string, in the database, which fails if the column isNOT NULL. Fill in missing values, or allowNULLin that column. Keep real zeros as0, because0and "no value" mean different things. - Remove duplicates, merged cells, totals, and notes. Only the data rows and the header row should be in the range you import.
- Check numbers and dates. Remove currency symbols and thousands separators from numbers, and use one date format, such as
2026-11-30.
The sample sheet is already clean: it has one header row, seven numeric columns, and no empty cells.
Create your databases on Sevalla#
- In the Sevalla dashboard, click Databases in the sidebar, then create a MariaDB database. Repeat this step for PostgreSQL if you want to follow both parts of this guide. See Create a database for every option.
- To connect tools outside Sevalla, such as Coefficient and Excel, open the database's Networking tab, and under External connection, click Enable.
- On the database's Overview tab, switch the Connection card to External to see the Host, Port, Database, User, and Password. You'll enter these details in each tool.
Anyone with these details can connect to your database, so keep them private. You can also limit which IP addresses can connect with IP restrictions. If you do, allow the addresses of the tools you connect, including Coefficient's servers, which connect on behalf of Google Sheets.
The quickest way: import a CSV file#
If you only need to move your data into a database once, you don't need any add-ins. Export your sheet as a CSV file, then import it with the SQL studio, the database client built into the Sevalla dashboard:
- In Google Sheets, click File > Download > Comma Separated Values (.csv). In Excel, click File > Save As and choose CSV UTF-8.
- Open your database in Sevalla, then open the SQL studio tab.
- Click the plus icon at the top of the sidebar, then click Import CSV, and choose your file.
- Choose Create table to create a new table from the file, or Seed data to insert the rows into an existing table with matching columns.
- Check the separator, that First row contains column names is selected, and the column types in the preview. Then review the statements and run them.
The SQL studio can also export any table or query result to CSV or .xlsx, so you can move data back to a spreadsheet the same way. See the database studio docs for details.
To keep a sheet and a database connected, so you can send new rows to the database or edit database rows from a spreadsheet, use a connector, as shown in the rest of this article.
How to connect spreadsheets to MariaDB#
Create the table in MariaDB#
Coefficient and the Devart add-in write to an existing table, so create the table first. Open the SQL studio tab of your MariaDB database, click SQL console, and run the following statement. You can also run it in any MySQL-compatible client, such as MySQL Workbench.
CREATE TABLE diabetes_table (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Pregnancies SMALLINT NOT NULL,
Glucose SMALLINT NOT NULL,
BloodPressure SMALLINT NOT NULL,
BMI DECIMAL(3,1) NOT NULL,
DiabetesPedigreeFunction DECIMAL(4,3) NOT NULL,
Age SMALLINT NOT NULL,
Outcome TINYINT NOT NULL
);The column names match the sheet's headers, and the types fit its values: whole numbers in SMALLINT columns, BMI values like 33.6 in DECIMAL(3,1), and pedigree values like 0.627 in DECIMAL(4,3). The id column numbers each row automatically, and as the primary key, it's already indexed and unique.
Connect Google Sheets to MariaDB#
-
Open your copy of the sample sheet in Google Sheets. It has seven columns, from Pregnancies to Outcome.

Google Sheets showing the diabetes data. -
Click Extensions in the menu bar.

The Google Sheets menu bar. -
Go to Coefficient: Salesforce, HubSpot Data Connector, and then click Launch.

The Extensions menu. This opens the Coefficient sidebar on the right side of your sheet, which lets you import data from the database and export data to it.
-
In Coefficient, click Export to, then click MySQL. Coefficient's MySQL connector works with MariaDB, because MariaDB uses the same protocol.
-
Enter the external connection details of your MariaDB database and click Connect.

Coefficient showing the details needed to connect to MariaDB. -
In the Source Data section, select diabetes from the Tab list and Row 1 from the Header row list.

The Source Data section showing the Tab and Header row fields. -
In the Destination section, select your database's diabetes_table from the Table list, and select Insert from the Action list.

The Destination section showing the Table and Action lists. In the Schemas panel, you see the spreadsheet columns.

The Schemas panel showing the spreadsheet columns. -
Map each spreadsheet column to the matching column of the MariaDB table and click Save. Leave
idunmapped, so the database numbers the rows.
The Field Mappings panel with columns mapped to MariaDB table columns. -
Select Specific rows on sheet and click Next.
-
Test the mapping by selecting a single row, such as row 12, and click Done selecting rows.

Google Sheets with row 12 selected. -
Confirm your selection by clicking Insert 1 row in MySQL. The spreadsheet now has a Record ID column, a Result column showing OK, and a Timestamp column showing the time of the export.

The selected row is exported successfully, with the result columns filled in. -
Click Done.
-
Select more rows to export, click Insert X rows in MySQL, and then click Done.
On Coefficient's free plan, each export can send up to 100 rows, and exports run manually. To export the whole sheet at once, or to schedule exports, you need a paid plan. Otherwise, use the CSV import shown earlier for the first load.
To check the data, run this query in the SQL studio or another client:
SELECT * FROM diabetes_table;Here's the result in MySQL Workbench:

If you name the database in the query, as in database_name.diabetes_table, and the name contains a hyphen, such as Sheets-db, wrap it in backticks: SELECT * FROM `Sheets-db`.diabetes_table;. Without them, MariaDB reads the hyphen as a minus sign and returns a syntax error.
Connect Excel to MariaDB#
The Devart Excel Add-in for MySQL connects Excel to MariaDB, imports data into a worksheet, and writes your edits back to the database. Install it before you start.
-
Open a blank Excel workbook.
-
Click the Devart tab, which appears after you install the add-in.

Excel showing the Devart tab. -
Click Get Data to open the Import Data Wizard.

The Devart tab with the Get Data button on the left. -
Select MySQL database as the Data Source and enter your MariaDB external connection details.

The connection editor showing the fields needed to connect to MariaDB. -
Click Test Connection. A "Successfully connected" message appears.
-
Click OK, then click Next.
-
Use the Visual Query Builder or a custom SQL query to import the data from the diabetes table into the worksheet.

The Import Data Wizard showing a custom SQL query. -
Click Finish. Your worksheet now has the data from the database.

Excel showing data from the cloud-hosted database. -
To edit the data and save your changes to the database, click Edit Mode. If you didn't save the password when you set up the connection, the add-in asks for it.

The Edit Mode button in the Edit Session group on the Devart tab. -
Add two new records at the end of the table.

The Excel sheet with two new records highlighted in yellow. -
Click Commit, then click OK to write the changes to the MariaDB database. To discard them instead, click Rollback.
-
Query the table again. It now has the two new records.

MySQL Workbench showing the two new records in MariaDB.
If you only need to read data into Excel, not write it back, Excel for Windows can also import from MySQL and PostgreSQL databases with Data > Get Data > From Database, without an add-in.
How to connect spreadsheets to PostgreSQL#
The steps for PostgreSQL are similar. Use your PostgreSQL database's external connection details, and create the table first.
Create the table in PostgreSQL#
Open the SQL studio tab of your PostgreSQL database, click SQL console, and run:
CREATE TABLE diabetes_table (
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
"Pregnancies" SMALLINT NOT NULL,
"Glucose" SMALLINT NOT NULL,
"BloodPressure" SMALLINT NOT NULL,
"BMI" NUMERIC(3,1) NOT NULL,
"DiabetesPedigreeFunction" NUMERIC(4,3) NOT NULL,
"Age" SMALLINT NOT NULL,
"Outcome" SMALLINT NOT NULL
);GENERATED ALWAYS AS IDENTITY numbers the rows automatically, so you don't need to create a sequence yourself. The column names are in double quotes to keep their capital letters, so they match the sheet's headers.
PostgreSQL converts unquoted names to lowercase, so you also need double quotes when you query these columns. SELECT "Glucose" FROM diabetes_table; works, but SELECT Glucose FROM diabetes_table; fails with column "glucose" does not exist. If you'd rather not quote names, use lowercase names, such as blood_pressure, in the table, and map the sheet's columns to them in Coefficient.
You can also use a desktop client such as pgAdmin. To connect it, right-click Servers, choose Register > Server, and on the Connection tab, enter your database's external host, port, database name (as the Maintenance database), username, and password.

Connect Google Sheets to PostgreSQL#
-
Open your sheet, click Extensions, go to Coefficient: Salesforce, HubSpot Data Connector, and then click Launch.
-
Click Export to, then click Connect beside PostgreSQL.
-
Enter your PostgreSQL external connection details and click Connect.
-
Select diabetes from the Tab list and Row 1 from the Header row list.

The Source Data section showing the Tab and Header row lists. -
Select public.diabetes_table from the Table list in the Destination section, and select Insert from the Action list.

The Destination section showing the public.diabetes_table table and the Insert action. -
Map the sheet's columns to the columns of your PostgreSQL table, leaving
idunmapped. -
Select a single row and click Done selecting rows.
-
Confirm your selection by clicking Insert 1 row in PostgreSQL. As with MariaDB, the sheet gets Record ID, Result, and Timestamp columns.
-
Test your integration by exporting more rows.
-
Run a query to view the imported data:
SELECT * FROM diabetes_table;
Connect Excel to PostgreSQL#
-
Open a blank Excel workbook and click the Devart tab.
-
Click Get Data to open the Import Data Wizard.
-
Select PostgreSQL database as the Data Source, and enter your PostgreSQL external connection details.
-
Click Test Connection to check the connection.
-
Select diabetes_table as the object and choose its columns with the Visual Query Builder, or write a custom SQL query.
-
Click Finish. Your worksheet now has the data. To get the latest data from the database at any time, click Refresh, then click Yes to confirm.

The Refresh button in the Import group on the Devart tab. -
Click Edit Mode to edit the sheet and the database.
-
Add a new record to the worksheet and click Commit to save it to the database.

The Edit Mode and Commit buttons in the Edit Session group on the Devart tab. -
Query the table to see the new record in the database.
Summary#
Spreadsheets are a good place to start, but a database gives growing data one source of truth, with types, constraints, and backups. In this article, you prepared spreadsheet data for a database, imported a CSV file with Sevalla's SQL studio, and connected Google Sheets and Excel to MariaDB and PostgreSQL with Coefficient and the Devart add-ins, so you can send rows to the database and edit database rows from a spreadsheet.
With Sevalla's Database Hosting, you can create managed PostgreSQL, MySQL, and MariaDB databases in minutes, connect your spreadsheet tools over the external connection, and browse, import, and export your data in the SQL studio without installing anything.