Home

Date errors when importing csv file to Access -

%3CLINGO-SUB%20id%3D%22lingo-sub-863853%22%20slang%3D%22en-US%22%3ERe%3A%20Date%20errors%20when%20importing%20csv%20file%20to%20Access%20-%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-863853%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F411757%22%20target%3D%22_blank%22%3E%40Blood4Iron%3C%2FA%3E%26nbsp%3BHello%20%2C%20check%20the%20attachment%20if%20this%20is%20what%20you%20are%20after%26nbsp%3B%3C%2FP%3E%3CP%3EThese%20are%20the%20first%201000%20lines%20of%20your%20csv....for%20this%20i%20used%20my%20custom%20CSV%20importer%20which%20is%20in%20a%20stage%26nbsp%3B%20that%20i%20cannot%20decide%20if%20i%20am%20going%20to%20release%20it%20to%20public%20or%20use%20it%20for%20small%20freelancing%20projects.%3C%2FP%3E%3CP%3EIf%20you%20don't%20get%20other%20helpful%20replies%20contact%20me%20and%20will%20sort%20it%20out.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJT%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-866909%22%20slang%3D%22en-US%22%3ERe%3A%20Date%20errors%20when%20importing%20csv%20file%20to%20Access%20-%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-866909%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F401564%22%20target%3D%22_blank%22%3E%40tsgiannis%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethere%20are%20other%20thousands%20of%20lines%20in%20the%20file.%20I%20only%20uploaded%20the%20first%201000%20because%20i%20thought%20it%20makes%20my%20case%20easier%20to%20understand.%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20image%20there%20are%20one%20million%20rows%20in%20the%20file%20and%20share%20a%20solution%20if%20applicable.%26nbsp%3B%3C%2FP%3E%3CP%3Ebr%2C%20Di%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-866994%22%20slang%3D%22en-US%22%3ERe%3A%20Date%20errors%20when%20importing%20csv%20file%20to%20Access%20-%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-866994%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F411757%22%20target%3D%22_blank%22%3E%40Blood4Iron%3C%2FA%3E%26nbsp%3BHi%20BI%3C%2FP%3E%3CP%3EThe%20way%20you%20are%20importing%20your%20.csv%20is%20the%20usual%20way...probably%20your%20problem%20is%20due%20to%20Access%20disregarding%20the%20comma%20%22%2C%22%20as%20delimiter%20and%20want%20to%20match%20agains%20system%20delimiter....for%20example%20my%20system%20delimiter%20is%20%22%3B%22%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20test%20it...just%20open%20your%20.csv%20with%20any%20text%20editor%20and%20do%20a%20replacement%20of%20comma%20to%20something%20else%20like%20%22%3B%22%20or%20%22%7C%22%20for%20example%3C%2FP%3E%3CP%3EThen%20redo%20the%20import%20process...select%20the%20new%20delimiter...it%20should%20finish%20just%20fine.%3C%2FP%3E%3CP%3EMy%20code%20doesn't%20care%20about%20system%20delimiters%20and%20such%20...it%20just%20accepts%20the%20delimiter%20you%20want%20to%20use%20and%20works%20by%20iterating%20the%20.csv%20line%20by%20line%20(thus%20its%20a%20bit%20slower)...on%20the%20other%20hand%20i%20have%20complete%20control%20on%20what%20to%20import%20and%20and%20how%20i%20want%20this%20imported....for%20example%20i%20could%20import%20numbers%20as%20text%20or%20format%20text%20to%20date...numbers%20to%20date...and%20so%20on.%3C%2FP%3E%3CP%3ENow%20for%20such%20a%20vast%20amount%20of%20lines%20(.csv)%20maybe%20you%20should%20consider%20full%20automation%20...like%20pointing%20a%20directory...iterating%20the%20.csvs%20...importing%20them....and%20then%20whatever%20manipulation%20you%20want....but%20this%20is%20beyond%20the%20scope%20of%20a%20simple%20question%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJT%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-862982%22%20slang%3D%22en-US%22%3EDate%20errors%20when%20importing%20csv%20file%20to%20Access%20-%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-862982%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%20everyone%2C%3C%2FP%3E%3CP%3EI%20encounter%20the%20following%20error%20when%20importing%20csv%20file%20to%20access.%26nbsp%3BCan%20someone%20advise%20me%20how%20to%20make%20Access%20read%20the%20data%20correctly%3F%3C%2FP%3E%3CP%3EI%20exported%20a%20csv%20file%20including%20a%20date%20column%20from%20Salesforce%20Marketing%20Cloud%20(default%20is%20American%20date%20format%20-%20MM%2FDD%2FYYYY%20HH%3AMM%3ASS.%20For%20instance%2C%209%2F23%2F2019%203%3A14%3A30%20PM)%3C%2FP%3E%3CP%3EWhen%20I%20import%20the%20csv%20file%20to%20Access%2C%20Access%20will%20return%20me%20errors%20for%20all%20the%20dates%20in%20the%20date%20column.%20Unfortunately%20I%20can%20not%20find%20why%20it%20wont%20work.%20I%20would%20appreciaite%20if%20someone%20can%20offer%20a%20simple%20solution%2C%20becuase%20I%20need%20to%20import%2010x%20different%20files%20everyday.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20attached%20the%20file%20and%20hope%20that%20helps.%20Thank%20you%20in%20advance.%26nbsp%3B%3C%2FP%3E%3CP%3Ebest%20regards%2C%20Di%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-862982%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-888865%22%20slang%3D%22en-US%22%3ERe%3A%20Date%20errors%20when%20importing%20csv%20file%20to%20Access%20-%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-888865%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F411757%22%20target%3D%22_blank%22%3E%40Blood4Iron%3C%2FA%3E%20The%20import%20usually%20looks%20at%20the%20Excel%20cell%20types%20for%20the%20first%20few%20rows.%26nbsp%3B%20Looks%20like%20although%20your%20values%20in%20EventDate%20look%20like%20a%20date%2C%20they%20are%20formatted%20as%20General.%26nbsp%3B%20I%20would%20try%20formatting%20them%20using%20the%20custom%20m%2Fd%2Fyyyy%20h%3Amm%20option%20in%20Excel.%26nbsp%3B%20Then%20make%20sure%20on%20your%20import%20mapping%20they%20are%20mapping%20to%20the%20type%20Date%20with%20Time%3C%2FP%3E%3C%2FLINGO-BODY%3E
Blood4Iron
New Contributor

Hello, everyone,

I encounter the following error when importing csv file to access. Can someone advise me how to make Access read the data correctly?

I exported a csv file including a date column from Salesforce Marketing Cloud (default is American date format - MM/DD/YYYY HH:MM:SS. For instance, 9/23/2019 3:14:30 PM)

When I import the csv file to Access, Access will return me errors for all the dates in the date column. Unfortunately I can not find why it wont work. I would appreciaite if someone can offer a simple solution, becuase I need to import 10x different files everyday. 

I attached the file and hope that helps. Thank you in advance. 

best regards, Di

4 Replies

@Blood4Iron Hello , check the attachment if this is what you are after 

These are the first 1000 lines of your csv....for this i used my custom CSV importer which is in a stage  that i cannot decide if i am going to release it to public or use it for small freelancing projects.

If you don't get other helpful replies contact me and will sort it out.

 

JT

Hi, @tsgiannis 

there are other thousands of lines in the file. I only uploaded the first 1000 because i thought it makes my case easier to understand. 

Please image there are one million rows in the file and share a solution if applicable. 

br, Di

@Blood4Iron Hi BI

The way you are importing your .csv is the usual way...probably your problem is due to Access disregarding the comma "," as delimiter and want to match agains system delimiter....for example my system delimiter is ";" 

To test it...just open your .csv with any text editor and do a replacement of comma to something else like ";" or "|" for example

Then redo the import process...select the new delimiter...it should finish just fine.

My code doesn't care about system delimiters and such ...it just accepts the delimiter you want to use and works by iterating the .csv line by line (thus its a bit slower)...on the other hand i have complete control on what to import and and how i want this imported....for example i could import numbers as text or format text to date...numbers to date...and so on.

Now for such a vast amount of lines (.csv) maybe you should consider full automation ...like pointing a directory...iterating the .csvs ...importing them....and then whatever manipulation you want....but this is beyond the scope of a simple question

 

JT

@Blood4Iron The import usually looks at the Excel cell types for the first few rows.  Looks like although your values in EventDate look like a date, they are formatted as General.  I would try formatting them using the custom m/d/yyyy h:mm option in Excel.  Then make sure on your import mapping they are mapping to the type Date with Time

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies