How to make linebreaks in an import - i.e. text for the "Description" field (TinyMCS)?

Hi good people.

How can I format my text for the "Description" field in my csv file so that I get a nice text with line breaks once I´m done importing into Sugar?

Here is my attempt in the csv file:

that produces this results:

As you can see, the <br> was stripped out but did not produce a new line. Get the same result with <p>, i.e. no new line.

Thanks,

KGM

Parents
  • I would suggest adding \r\n instead of <br> and/or <p> into the text that you are importing from. I think that should give you the expected results.

    The field description in your emails_text table is what you see on the screen when you open up to read an email. To insert a linebreak into an sql table, you need \r\n\

  • If you want to import linefeeds (\n, not "\n") you must produce them in your csv input file.

    To do that you must make sure that all fields are encapsulated by quotes or apostrophes.

    With Excel it an be difficult to create such files, Libre Office normally works.

    Such a csv file looks (e.g. in Notepad++):

    "firstname","lastname","description
    with a line break or
    even two","other data"

    "fistname2","lastname2","description without break","other data2"

    \n is a unix synonym for the hexadecimal character 0x0a which means "line feed"

    \r is the unix synonym for the hexadecimal character 0x0d which means "carriage return"

    in Unix \n is used to terminate lines, in Windows \r\n

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

  • Great minds think alike  (except I referred to \n as "new line" not "line feed" and I didn't want to confuse anyone with hexadecimal explanations. Escaping is normally complex enough!)

    With Excel, it is trickier but possible to enter line breaks in a cell of text. Within a cell, to create a multi-line text you need to hold down the "Alt" key and then press the "Enter" (or "Return") which will create a new line in the cell text rather than move to another cell. You then need to "Save As..." "CSV (MS DOS) *.csv" in order to produce a true text, CSV file. This should then automatically enclose the text within double quote marks (but that option is configurable in Excel if you want to use a different enclosure character such as a single quote).

    For avoidance of doubt here, I use Linux as my main O/S for Sugar work - hence my affinity to sed & awk. However, as almost invariably data for migrations will be received from customers in Excel format it is important to know that it can be converted reasonably easily into CSV for importing into Sugar (or other database systems) from that tool as well.

    Hope this helps someone,

    JH.

Reply
  • Great minds think alike  (except I referred to \n as "new line" not "line feed" and I didn't want to confuse anyone with hexadecimal explanations. Escaping is normally complex enough!)

    With Excel, it is trickier but possible to enter line breaks in a cell of text. Within a cell, to create a multi-line text you need to hold down the "Alt" key and then press the "Enter" (or "Return") which will create a new line in the cell text rather than move to another cell. You then need to "Save As..." "CSV (MS DOS) *.csv" in order to produce a true text, CSV file. This should then automatically enclose the text within double quote marks (but that option is configurable in Excel if you want to use a different enclosure character such as a single quote).

    For avoidance of doubt here, I use Linux as my main O/S for Sugar work - hence my affinity to sed & awk. However, as almost invariably data for migrations will be received from customers in Excel format it is important to know that it can be converted reasonably easily into CSV for importing into Sugar (or other database systems) from that tool as well.

    Hope this helps someone,

    JH.

Children
No Data