PostgreSQL's COPY command and the psql \copy wrapper for it do not understand or support the Microsoft Office Excel (xls) or Microsoft Office XML Spreadsheet (xlsx) file formats.
You must either save the Excel file as CSV and use \copy ... CSV, or use an ETL tool that does understand the Microsoft Excel format. Saving as CSV will be the easiest way by far.
The data in the Excel sheet must be compatible with the PostgreSQL column definitions for the table you are copying into. You cannot copy values like ABC123 into an integer column, for example.
If your Excel data is messy, full of invalid values, and otherwise problematic consider cleaning it up in Excel first by adding validation. Alternately you could import it into a TEMPORARY or UNLOGGED PostgreSQL table where the problem columns are all defined with the text data-type, then use an INSERT INTO ... SELECT command to insert cleaned up data into the final table. A final option is again to use an ETL tool like one of the aforementined to clean the data up as it's loaded and inserted.
Which approach you choose will depend on whether you're more comfortable working with SQL queries, with ETL tools, or with Excel.
SET client_encoding = win1252;before the\copy ...line? (not sure about the exact syntax, please check the Fine Manual for that) UPDATE: you don't need varchar(16), just use varchar, and the size will be virtually unlimited. Not sure about the cid. More info is needed.cid(look near the bottom of the page), try renaming yourcidto something else. If you're having a length problem with avarchar(16)then you have something longer than 16 characters, consider cleaning up your data before trying to import it.