[postgis-users] Excel to Postgres

Stefan Keller sfkeller at gmail.com
Mon Feb 15 15:26:27 PST 2010


Assuming you have Windows you could either use ODBC and make a system
DSN entry :
> c:\windows\system32\odbcconf /a CONFIGSYSDSN "Microsoft Excel Driver (*.xls)" "DSN=test|DBQ=c:\test.xls|DefaultDir=C:|Description=Test"

or use Visual Basic as a macro in a master Excel

or use Java and http://poi.apache.org/ API for Microsoft documents.

-S.

2010/2/15  <Steve.Toutant at inspq.qc.ca>:
>
> Hi,
> Every day I receive an Excel file containing lat long coordinates. I need to
> import it to postgis.
> Currently, I save the Excel file in CSV format and I use ogr2ogr to import
> the contents into postgis. I would like to avoid human intervention.
>
> I tried unsuccessfully  to define an ODBC link on the Excel file and use
> ogr2ogr with odbc to import it to postgres/postgis.
> I got this error
> [Microsoft][ODBC Excel Driver] External table is not in the expected format
>
> Here is the command I sent
> ogr2ogr -f "PostgreSQL" PG:"host=xxx user=xxx password=xxx dbname=geo"
> "ODBC:odbc_urg,test" -nln "testODBCxls" -overwrite
>
> where test is the sheet name inside the excel file
>
> Anyone has a better idea on how to programmatically import excel data into
> postgis?
> thanks
> Steve
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>



More information about the postgis-users mailing list