DEV Community

Cover image for How to Import/Export CSV file in pgAdmin
Syeda Maham Fahim
Syeda Maham Fahim

Posted on

How to Import/Export CSV file in pgAdmin

Working with databases often involves handling large amounts of data. One of the most common ways to import or export data is through CSV files.

This article covers simple steps for importing and exporting CSV files using pgAdmin.

Let’s get started!

Importing CSV into pgAdmin

  1. Right-click on the table where you want to import the CSV file.

    • A popup will appear. Table Right Click
  2. Click on the folder icon (highlighted in the green square).

    • A new popup will open. popup
  3. Click on the three horizontal dots on the right side of the popup.

    • A dropdown menu will appear with the “Upload” option. Upload option
  4. Upload the file.

    • After selecting the "Upload" option, a new popup will appear where you can choose your file. upload popup
    • Note: The maximum file size is 50MB, so make sure your file doesn't exceed this limit.
  5. Close the popup by clicking on the first 'X' button. Don’t click the second one as it will remove the file from the list.
    close button

  6. Select the file you just uploaded.
    selection

  7. Ensure the CSV Columns Match the Database.

    • Make sure the columns in your CSV match those in your database table.
    • In the screenshot below, the database columns are id, published_date, city, etc. database columns
  8. CSV Columns.

    • Similarly, ensure that your CSV file has the same columns in the same positions as the database. csv
    • Note: The id column is not included in the CSV because PostgreSQL will generate this automatically.

Excluding Unwanted Columns

  1. Exclude unwanted columns.

    • In the "Columns" tab, remove the columns that you don’t want to import (e.g., id, created_at, updated_at). exclude_columns
  2. Click OK to complete the import process. Your CSV file will be successfully imported into pgAdmin.


Exporting CSV from pgAdmin

  1. Go to the Export tab and click the folder icon to choose the file location where you want to export your data.

  2. Click the 'Export' button to start the process. Once completed, a success message will appear
    success message

Accessing the Exported CSV

  1. Where to find your exported CSV file?

    • Don’t worry! You can easily find your exported file by clicking on the Tools option in the header, followed by Storage Manager. Storage Manager
  2. A new popup will show all your stored files.
    all_files

  3. Select the file and click on the download button to get your exported CSV file.


Conclusion

And there you have it!

You've learned how to import and export CSV files in pgAdmin easily.

This process is quite simple once you get the hang of it, and it's a great way to manage your data.

Stay Connected - @syedamahamfahim 🐬

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo 📊✨

Top comments (0)

Image of PulumiUP 2025

Let's talk about the current state of cloud and IaC, platform engineering, and security.

Dive into the stories and experiences of innovators and experts, from Startup Founders to Industry Leaders at PulumiUP 2025.

Register Now

👋 Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s day—drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay