This question has been flagged
5 Replies
20800 Views

When I use export tool, carriage returns in fields (eg: partner comment, product description) are converted into spaces.

When I re-import the generated file, there is no more CR in fields, the whole content is in one line separated with spaces.

Is it possible to import data fields with multiples lines with CSV file ?

Avatar
Discard
Best Answer

You should add double quotes " around fields with special characters including new line.

OpenERP uses the standard python csv module to decode csv input with the parameters: quotechar='"', delimiter=','.

Avatar
Discard

This solution works fine for import, but when you export datas from openERP, make some modifications and want to re-import them, you must put CR again on each description lines that already have before export.

Author

I agree, import works fine with CR within delimiters and export of such imported data is OK too. But records created or modified with OpenERP interface are not exported correctly (CR are converted into space). It's a little annoying...

Best Answer

It normally works fine - I have never had this problem

The file at http://www.filedropper.com/respartner was directly exported from OpenERP 7.0 and all carriage returns are preserved.

It sounds like it is either the editor you are using; the method you are using to get the file to your computer (email, file transfer); or something to do with your regional settings that affect field delimeters.

Avatar
Discard
Author

There is no carriage returns into fields in your example file. Carriage returns are only at the end of the lines to separate records.

Author

I'm sorry but I still can't see carriage returns (with various editors) in your file except at the end of the lines. Can you tell me on which record and in which field ?

Author

Never mind Ray. I just wondered if I wasn't becoming crazy. But my problem is still here. I think it's not possible to import fieds that contains multiples lines of text.

I remember I did need to do this once and had the same problem. I replaced all the carriage returns with a proxy character like ~ hoping that I could then fix the problem after they were imported. This was so long ago I think I gave up because it was too hard for me.

Best Answer

Yes it is possible, I do it everyday without any problem. (with V6.1) OpenERP csv import and export feature works without any problem.

You should use a better csv file editor. I use ASAP extension for excel to import and export csv files http://www.asap-utilities.com

Openoffice also imports csv files nicely however cannot export them nicely (if you have HTML tags and CR LF characters in the fields.

For changing encoding of files to UTF-8 I use Notepad++ (cut the text -> change the encoding -> paste the text back)

Avatar
Discard
Author

I'm OK with you, import/export works very well. But with fields like comments, notes which can contains multiples lines (separated with CR/LF), import/export doesn't work. It is impossible to handle multiple lines. CR are converted into spaces in export, and it's impossible to import CR/LF into one field.

I did not see any CR in the fields either. I am using Notepad++.

Best Answer

HTML worked for me.

Avatar
Discard
Best Answer

Hi  WANTELLET Sylvain,

I think this module can help you: https://apps.odoo.com/apps/modules/16.0/vks_import_excel

Demo: https://www.youtube.com/watch?v=etMYrOJyaiU&list=PLSKcWRTtEl5qzvRaI-VTGavfReiHS_EEb&index=2

Avatar
Discard