If you’re not familiar with importing data using DBeaver, then I encourage you to view my previous blog here:

This time I will show you how to update data using a csv file inside DBeaver.

Connecting to the csv File

Right-click your database connection (or anywhere if your connections are empty), click Create and then click Connection.

connecting to csv file create connection

Make sure the All tab is select on the left and scroll down to CSV. Click Next.

select database all tab csv

Click Browse… and select the folder where your csv file is that you saved from Excel. You’re selecting a folder here, not a file. The connection will load ALL csv files in that folder. Click Finish.

browse folder csv

You will now see a new connection; this connection is set up exactly like a regular connection. Each csv file in your folder will be set up as a table with columns.

new connection csv file as table

Updating Data

The data in the current PostgreSQL table looks like this:

data in current PostgreSQL table example

Our csv file data looks like this:

csv file data example

Create Staging Table

We’ll need to create a staging table to perform our updates from using the csv data. You can right-click your PostgreSQL table, click Generate SQL and then click DDL. Copy the create statement, change the table name, and execute.

create staging table generate SQL DDL
create table imports

Import Stage Data

Now we can import the stage data for our update, right-click your stage table, click Import Data, select Table and click Next. Change the source to your CSV connection table and click Next.

import stage data for update

Check that the mapping is existing and click next, next again on the transfer settings and then click Finish to start the import.

SQL Update

Now we can use generic sql to update the data.

generic sql update the data

We can now see that the table has been updated.

data update to table

If you’re looking for other ways to import files into DBeaver, check out my other blog:

PostgreSQL Custom Delimited Imports with DBeaver