Bug 112108 - CSV Import doesn't interpret Timestamp, formulas won't calculate.
Summary: CSV Import doesn't interpret Timestamp, formulas won't calculate.
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.3.3.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-30 13:51 UTC by John Jackson
Modified: 2017-08-31 04:52 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
CSV file to import, timestamp in first column. (1.32 MB, text/plain)
2017-08-30 13:51 UTC, John Jackson
Details
Example imported file, formulas in col. B don't calculate (412.93 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-08-30 13:53 UTC, John Jackson
Details
imported csv (866.08 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-08-30 17:20 UTC, Jean-Baptiste Faure
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Jackson 2017-08-30 13:51:31 UTC
Created attachment 135872 [details]
CSV file to import, timestamp in first column.

Importing this file "170811_F5.csv" into LO, the timestamp column is not interpreted as a timestamp. This is revealed if you insert a column B and try to type in the formula "=(A2-$A$2)*24" in cell B2. After this any formula typed in column B does not calculate. Checking the format of column A it is "text," but changing to a Date/Time option only puts a "'" at the start and does not accept the format as timestamp. MS Excel has no trouble importing this column and recognizing the data type.
Comment 1 John Jackson 2017-08-30 13:53:41 UTC
Created attachment 135873 [details]
Example imported file, formulas in col. B don't calculate

Example imported file saved as ODS, formulas in col. B don't calculate.
Comment 2 Jean-Baptiste Faure 2017-08-30 17:17:31 UTC
This bug tracker is not an helpdesk. Before filling a bug report you should ask for help on the users mailing list or on the askLibo (https://ask.libreoffice.org).

The solution:
1/in the cvs import dialog choose
- language: English (USA)
- separator: comma
- select the first column and choose Date (MDY) instead of standard
- validate
2/ in the imported sheet:
- select the first column
- right click and Format Cell...
- instead of Number choose Date under Category and the language English (USA) 
- under Format choose the one with PM at end, you get the format code MM/DD/YY HH:MM AM/PM
- validate
3/ check

The problem in your ods file is that you imported the first column as text (values in cells are aligned left instead of right).

See my attachment.
Closing as WorksForMe

Best regards. JBF
Comment 3 Jean-Baptiste Faure 2017-08-30 17:20:23 UTC
Created attachment 135878 [details]
imported csv
Comment 4 John Jackson 2017-08-30 17:39:42 UTC
Forgive me. I saw the "Date" option for imports but presumed that meant Date data type, whereas I expected to see DateTime or Timestamp data type as an option. So used to Excel doing this automatically.
Comment 5 Jean-Baptiste Faure 2017-08-30 17:56:07 UTC
(In reply to John Jackson from comment #4)
> Forgive me. I saw the "Date" option for imports but presumed that meant Date
> data type, whereas I expected to see DateTime or Timestamp data type as an
> option. So used to Excel doing this automatically.

Indeed LO is not a clone of MS-Office ;-)

Best regards. JBF
Comment 6 m_a_riosv 2017-08-30 20:43:25 UTC
Sorry @Jean but if I'm not wrong the PM it's not accepted and hours are imported without take care of it.
Comment 7 Jean-Baptiste Faure 2017-08-31 04:52:22 UTC
(In reply to m.a.riosv from comment #6)
> Sorry @Jean but if I'm not wrong the PM it's not accepted and hours are
> imported without take care of it.

Oops, my mistake. You are right if we choose Date (MDY) for the first column, but it works as expected if we choose "US English". Once imported you can change the date format to 24 hours time cycle with "MM:DD:YYYY HH:MM:SS" format code (choose  "12/31/1999 13:37:46" in the list). Then you get 08/11/2017 13:55:02 in A2.

Best regards. JBF