Import and export of Excel in the Postgres database

Source: Internet
Author: User
Tags postgres database postgres version

With Windows systems, Excel is always unavoidable.

The Postgres version is 9.3.6;windows 8.1 64-bit.

There is no way to find Excel directly import Postgres, there is a tool is XLSTOPG, similar to SQL Server Import and Export Data Wizard, but not open source; You can search the Internet to play (as if the trial version can only guide 1000 records), I am not well-known site up and down an attempt is cracked version, the result of computer poisoning, spent two night time, the computer was fortunately no reload system. I can only say that some sites are not things, you say you have a lot of plug-ins (the game's client, calendar and other messy things), I endure, but also pop up so many ads (games, Pornography) Web page, I TMD also endure, who let me want to save the cheap hand to download it? The Green Egg. Or the first time I downloaded on other sites like XLSTOPG can only guide 1000 records, which I also tmd to endure; the key is nnnd, I unload the mess, the internet for about 20 minutes, the lower right corner of the desktop out of the ads, jump, the CPU quickly 100% And very stable has been 100%. Well, complaining about it, I'm going to write down the process of dealing with this event.

Here's how to work with Excel: Postgres has a copy command to import the CSV format into the database. Save Excel as CSV format and import postgres; First, make the table, and then use the following command

Command: Copy test from ' D:/a.csv ' delimiter as ', ' csv quote as ' "'

Test is a table name

' D:/a.csv ' means the path, the path contains Chinese not, probably because my postgres encoding format is UTF8, anyway, I use Chinese not, instead of English is good.

If the results of the query are to be exported to Excel, I will also pilot the TXT format and then convert to Excel.

CSV format, using SQL query window file--Export

Then build Excel open txt, also need to choose character encoding, etc., copy may be garbled, and finally save as Excel format is OK.

Import and export of Excel in the Postgres database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.