Excel File to Postgres Database Datatype Formatting

More
8 hours 12 minutes ago #26318 by bwakley
I am trying to consume an Excel spreadsheet and write it out to a Postgres database table.  When I pull in the Excel sheet, I am seeing where everything is coming in as a string value from Excel.  I have some fields in the spreadsheet that are dates, times, and numbers (both integer and float/numeric (dollar amounts).  If I don't configure my Postgres table to be all VARCHAR data types, I get the following error when trying to write the numeric data via the writer: Record/Line:12 Record Rejected: Field: gross Value: 62.51 Datatype: NUMERIC Message: Could not convert variant of type (Null) into type (OleStr).  I have looked through the transformations, but I cannot find a way to set a numeric data format like you can a date format.
How can I convert those string values to numbers so I can use NUMERIC data types in the database and not have to use VARCHAR?
The following user(s) said Thank You: Peter.Jonson

Please Log in or Create an account to join the conversation.

More
7 hours 49 minutes ago #26319 by Peter.Jonson
Hi Bill

Welcome to the forum.

Most likely all you need to do is to replace dot with comma. eg 6.96 => 6,96

This can be done using using replace transformation function
www.etl-tools.com/wiki/advanced-etl-proc...ons/strings/replace/

You might have some leading and trailing spaces you cannot see.
Use trim function for it
www.etl-tools.com/wiki/advanced-etl-proc...ctions/strings/trim/  

also get rid of any special characters $1,120,100.12 => 1120100,12 
 

Peter Jonson
ETL Developer

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save