Sunday, 15 March 2015

Postgresql - Populating database from Excel File -



Postgresql - Populating database from Excel File -

i want populate client database excel file , using \copy command next error. can please help me this?

\copy client '/home/2008/uehtes/desktop/comp421/data.xlsx'; error: invalid byte sequence encoding "utf8": 0xde76 context: re-create customer, line 1

postgresql's copy command , psql \copy wrapper not understand or back upwards microsoft office excel (xls) or microsoft office xml spreadsheet (xlsx) file formats.

you must either save excel file csv , utilize \copy ... csv, or utilize etl tool understand microsoft excel format. saving csv easiest way far.

the info in excel sheet must compatible postgresql column definitions table copying into. cannot re-create values abc123 integer column, example.

if excel info messy, total of invalid values, , otherwise problematic consider cleaning in excel first adding validation. alternately import temporary or unlogged postgresql table problem columns defined text data-type, utilize insert ... select command insert cleaned info final table. final alternative 1 time again utilize etl tool 1 of aforementined clean info it's loaded , inserted.

which approach take depend on whether you're more comfortable working sql queries, etl tools, or excel.

postgresql

No comments:

Post a Comment