3

I have a PostgreSQL database at work that is a single table of data. The theme of the data is computers - things like physical location, MAC address, serial number, and computer name.

I need to get this data exported to an Excel spreadsheet. I have Perl with DBD::Pg loaded on a laptop, so a programmatic solution is possible if need be.

Should I process the whole thing line-by-line with a loop, or is there an easier way to get a CDL? Has anyone had any experience with doing this sort of thing successfully before?

Thanks so much.

3 Answers 3

4

If the solution doesn't have to be programmatic, this should help: archives.postgresql.org article

Sign up to request clarification or add additional context in comments.

Comments

3

This is not really a programming answer, but this has already been programmed, if exporting to CSV is acceptable.

You can look into:

  • using COPY,
  • using the \o or \copy commands in psql (there's quite a lot of references if you google something like "psql export csv"),
  • if you have a tool like pgAdmin, you can export the results of a query in File->Export...

Comments

1

If you have access to a Mac then Navicat for PostgreSQL Lite will allow you to do exactly this and is available for free in the Mac App Store. It is really simple to use and has a great interface to setup the connection to the database and to browse to the information you need.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.