Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2010
    Location
    Orlando, FL
    Posts
    311
    Provided Answers: 1

    Unanswered: Trouble Copying Spreadsheet Over

    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:

    Code:
    CREATE DATABASE import
    WITH ENCODING = 'UTF8'
    OWNER carlos
    ;
    The book I'm referencing states:

    Quote 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?

  2. #2
    Join Date
    Jun 2010
    Posts
    17
    Yes, You have to create a table will columns presented in .csv file, before you attempt to load the data [Copy to ..] into table.

    --Raghu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •