I'm having some problems trying to copy a XLS spreadsheet I created into PostgreSQL. I know this is a common DBA task so I decided to test and practice this myself.
- I created a XLS file from scratch with some random / generic data.
- I then converted this data from .XLS to .CSV.
- I created the database in PostgreSQL:
CREATE DATABASE import
WITH ENCODING = 'UTF8'
The book I'm referencing states:
Originally Posted by PostgreSQL 9 Administration Cookbook
If your spreadsheet data is neatly laid out (which it is - I self generated a test spreadsheet) in a single worksheet, then you can do File | Save As and then select CSV as the file type to be saved.
I have the .CSV file on the database server and now I'm attempting to COPY the data from the .CSV file to the newly created database. But I'm unclear if I MUST create the table parameters before I attempt to load the data into the table? Obviously it's a newly created database so there are no relations / tables present. Do I need to manually create the table before I attempt to copy the data?