Обсуждение:

Поиск
Список
Период
Сортировка

От
"Ben Hooper"
Дата:
Hello All,

How would I go about importing a large M$ Excel sheet into a PostgreSQL
database?

Regards,

Ben Hooper

------------------------------------------------
Systems Consultant
Email: Ben.Hooper@diskcopy.com.au
PGP: http://www.diskcopy.com.au/pgp/bh.pgp
------------------------------------------------

Estridge's Law:

"No matter how large and standardised the marketplace is, IBM can
redefine it."

-----------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer.



RE: Importing Excel Spreadsheets into PostgreSQL

От
"Ben Hooper"
Дата:
> Hello All,
>
> How would I go about importing a large M$ Excel sheet into a
> PostgreSQL
> database?
>

After a few dozen combinations I was able to answer my own question.

1. Save the Excel spreadsheet as comma delimited.

2. run 'psql mydatabase'

3. run 'COPY mytable FROM '/myfile.csv' USING DELIMITERS ',';

and it works!



RE: Importing Excel Spreadsheets into PostgreSQL

От
Francisco Reyes
Дата:
> After a few dozen combinations I was able to answer my own question.
> 1. Save the Excel spreadsheet as comma delimited.
> 2. run 'psql mydatabase'
> 3. run 'COPY mytable FROM '/myfile.csv' USING DELIMITERS ',';
> and it works!


I am new to PostgreSQL myself, but from the little I have seen Pgsql uses
tabs as it's native separator. In other words if you can save that ascii
file using tabs as a separator you won't need to add a DELIMITERS clause.