Thread: BUG #14211: i am enable to upload .xlsx file in my postgres database.

BUG #14211: i am enable to upload .xlsx file in my postgres database.

From
zzia88@gmail.com
Date:
VGhlIGZvbGxvd2luZyBidWcgaGFzIGJlZW4gbG9nZ2VkIG9uIHRoZSB3ZWJz
aXRlOgoKQnVnIHJlZmVyZW5jZTogICAgICAxNDIxMQpMb2dnZWQgYnk6ICAg
ICAgICAgIFp1YmFpciBBbGFtCkVtYWlsIGFkZHJlc3M6ICAgICAgenppYTg4
QGdtYWlsLmNvbQpQb3N0Z3JlU1FMIHZlcnNpb246IDkuNS4zCk9wZXJhdGlu
ZyBzeXN0ZW06ICAgd2luZG93czcteDY0KDY0IGJpdCkKRGVzY3JpcHRpb246
ICAgICAgICAKCmNvcHkgcGVyc29uKGZpcnN0X25hbWUsbGFzdF9uYW1lLGRv
YixlbWFpbCkgZnJvbSAnRDpccGVyc29uXHBlcnNvbi54bHN4Jwp3aXRoIGRl
bGltaXRlciAnLCcgY3N2IGhlYWRlciBlbmNvZGluZyAnV0lOMTI1Nic7DQoN
Cm15IGNsaWVudCBjbGllbnRfZW5jb2RpbmcgaXM6LSBVTklDT0RFDQogaSBh
bSBydW5uaW5nIHRoaXMgY29kZSBvbiBteSBob3N0IG1hY2hpbmUNCg0KQXQg
dGhlIHJ1bnRpbWUgaSBhbSBnZXR0aW5nIHRoaXMgZXJyb3I6LUVSUk9SOiAg
aW52YWxpZCBieXRlIHNlcXVlbmNlIGZvcgplbmNvZGluZyAiV0lOMTI1NiI6
IDB4MDANCkNPTlRFWFQ6ICBDT1BZIHBlcnNvbiwgbGluZSAxDQoNCmlmIGkg
YW0gcHJvdmlkaW5nIGNzdiBoZWFkZXIgZW5jb2RpbmcgOi0nVU5JQ09ERShV
VEY4KSB0aGVuIGkgYW0gZ2V0dGluZwp0aGlzIGVycm9yOi1FUlJPUjogIGlu
dmFsaWQgYnl0ZSBzZXF1ZW5jZSBmb3IgZW5jb2RpbmcgIlVURjgiOiAweDAw
DQpDT05URVhUOiAgQ09QWSBwZXJzb24sIGxpbmUgMQ0KDQoqKioqKioqKioq
IEVycm9yICoqKioqKioqKioNCg0KRVJST1I6IGludmFsaWQgYnl0ZSBzZXF1
ZW5jZSBmb3IgZW5jb2RpbmcgIlVURjgiOiAweDAwDQpTUUwgc3RhdGU6IDIy
MDIxDQpDb250ZXh0OiBDT1BZIHBlcnNvbiwgbGluZSAxDQoNCg0KUGxlYXNl
IHNvbHZlIHRoaXMgcHJvYmxlbSBhcyBzb29uIGFzIHBvc3NpYmxlIGFuZCB0
ZXN0IHRoYXQgY29kZSB0aGVuCnByb3ZpZGUgbWUgdGhhdCBjb2RlIG9yIHNv
bHV0aW9uLgoK

Re: BUG #14211: i am enable to upload .xlsx file in my postgres database.

From
"David G. Johnston"
Date:
On Thu, Jun 23, 2016 at 12:56 PM, <zzia88@gmail.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      14211
> Logged by:          Zubair Alam
> Email address:      zzia88@gmail.com
> PostgreSQL version: 9.5.3
> Operating system:   windows7-x64(64 bit)
> Description:
>
> copy person(first_name,last_name,dob,email) from 'D:\person\person.xlsx'
> with delimiter ',' csv header encoding 'WIN1256';
>
> my client client_encoding is:- UNICODE
>  i am running this code on my host machine
>
> At the runtime i am getting this error:-ERROR:  invalid byte sequence for
> encoding "WIN1256": 0x00
> CONTEXT:  COPY person, line 1
>
> if i am providing csv header encoding :-'UNICODE(UTF8) then i am getting
> this error:-ERROR:  invalid byte sequence for encoding "UTF8": 0x00
> CONTEXT:  COPY person, line 1
>
> ********** Error **********
>
> ERROR: invalid byte sequence for encoding "UTF8": 0x00
> SQL state: 22021
> Context: COPY person, line 1
>
>
> Please solve this problem as soon as possible and test that code then
> provide me that code or solution.
>
>
=E2=80=8BNot a bug.

Native Excel files are not CSV formatted.  Attempting to import them as-is
via copy will not work.  You need to get the Excel data into a format that
PostgreSQL can digest.  For simple cases performing a "Save As" and
changing the file type to CSV will work.=E2=80=8B

David J.