Ask Your Question
0

Libreoffice Base - csv with dates import [closed]

asked 2013-05-14 13:01:45 +0200

hafron gravatar image

Hi, several days ago I must import to Base several csv files. To do this I've opened them in Calc and them copy and paste them to Base window. Nearly everything imported fine. Except date import. I'll try to explain this by example.

I have table "test" in Base:

id -> integer
name -> varchar
date -> date with format changed to(DD-MM-YYYY)

And csv file:

1; foo;12-05-2010                        
2;bar;14-07-2003
3;test;05-04-1987

I open it in calc, select this 9 cells and copy them to Base. Then i select option append data and click "Create". After a while the window shows, with following error message:

Warning!
Wrong data type: java.lang.IllegalArgumentExcetpion
Do you want to continue?

After pressing "Yes" my table rows looks like this:

id  imie    uro
1   zbynio  
2   jan 
3   wojtek

How can I import date fileds from csv correctly?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-11-01 12:41:24.113127

2 Answers

Sort by » oldest newest most voted
0

answered 2013-05-14 14:54:42 +0200

oweng gravatar image

updated 2013-05-16 12:14:20 +0200

Does using an ISO 8601 date format of YYYY-MM-DD work? Refer this answer about ISO 8601 dates and LO.

2ND EDIT: Thanks are due to @mariosv for correcting my initial answer. It will probably be easiest to manipulate the data in Calc before export to Base, however it requires a few steps. Using your example CSV:

  1. Import the data into Calc. Select Detect special numbers and click on the date column and set the format to Date (DMY). Text Import
  2. Format column C to use ISO 8601 date format YYYY-MM-DD. Format Cells
  3. This will give you the ISO date data you require. Required data
  4. Save and import to Base as per usual.
edit flag offensive delete link more

Comments

Ok in standand format it working. But if there is any simple method to convert dana in my format to ISO 8601.

hafron gravatar imagehafron ( 2013-05-15 11:24:22 +0200 )edit
0

answered 2013-05-16 10:09:16 +0200

m.a.riosv gravatar image

updated 2013-05-16 10:10:29 +0200

In the point 1 of Oweng answer, you can select what is the data format for a proper import, click on the column Title and select the column type:

image description

or from point 2 of Oweng answer, you can select column C data and use Menu/Data/Text to column with the same option for the column as in the above image.

edit flag offensive delete link more

Comments

Thanks for this correction. In my haste I completely forgot about selecting the column on CSV import. I will update my post.

oweng gravatar imageoweng ( 2013-05-16 11:58:00 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2013-05-14 13:01:45 +0200

Seen: 5,102 times

Last updated: May 16 '13