Excel 2016 incorretly importing CSV files - bug?

Anonymní
2021-01-09T19:33:18+00:00

Excel 2016 incorrectly imports CSV files with multiline "cells".

CSV files can contain "multiline cells" when the text of the cell is in quotation marks and line break is in between (see e.g. discussion here: https://stackoverflow.com/questions/566052/can-you-encode-cr-lf-in-into-csv-files).

Issue:

When Excel opens this file, it applies a "next-row-break" and divides the text into several rows/cells. (instead of putting the whole multiline text in one cell).

Reproducibility:

Have a CSV file with multiline cell content, like specified e.g. here:

https://stackoverflow.com/questions/566052/can-you-encode-cr-lf-in-into-csv-files

Open and import it via Excel wizard.

Or is there some setting in the import wizard I am missing?

Microsoft 365 a Office | Excel | Pro domácnosti | Windows

Otázka je uzamčená. Tato otázka se migrovala z komunity podpory Microsoftu. Můžete hlasovat, jestli je užitečná, ale nemůžete k ní přidávat komentáře či odpovědi ani ji nemůžete sledovat.

Počet komentářů: 0 Žádné komentáře
Odpověď přijatá autorem otázky
Anonymní
2021-01-09T23:41:12+00:00

Hello MarekVajgl

Since I have never run across any issues with Excel dealing with multi-line fields in a CSV file when properly bracketed with double-quotes, decided to run some a couple of tests with both Excel '2016 and '365 just to double-check things and ran into an interesting anomaly I wasn't previously aware of

For this test, just created (really simple) two different CSV files with a single row (didn't bother with a header row) - the first works and second does exactly what you are running into

There is a very subtle difference between the two files which is that there is no space after the comma following the first field

  1. This works

"Field1","Field2

multiline","Field3"


  1. This doesn't

"Field1", "Field2

multiline","Field3"


Without playing without the actual data, it would be virtually impossible to determine the exact cause. There is no special setting for the handling of multi-line fields in a CSV file.

Byla tato odpověď užitečná?

Počet komentářů: 0 Žádné komentáře

Počet dalších odpovědí: 6

Seřadit podle: Nejužitečnější
  1. Miroslav Pragl 79,206 Reputační body Dobrovolný moderátor
    2021-01-20T21:34:10+00:00

    Pro zacatek mrkni do adresniho radku. https://answers.microsoft.com/**cs-cz**

    Jak pise Karl: problem muze byt v nesmyslne mezere mezi carkou a uvozovkami

    MP

    Byla tato odpověď užitečná?

    Počet komentářů: 0 Žádné komentáře
  2. Anonymní
    2021-01-20T19:34:57+00:00

    Ok, díky za upozornění a omlouvám se za porušení pravidel. Ale i přes snahu jsem teď nenašel, jak se tady přepnu do EN fóra (a navíc, jak tady zjistím, že to je české fórum).

    Byla tato odpověď užitečná?

    Počet komentářů: 0 Žádné komentáře
  3. Anonymní
    2021-01-20T19:34:00+00:00

    Thank you for your answer and sorry for the delay.

    Unfortunately, probably I am doing something incorrectly, but none of your examples works for me. For me, both of them are with a row-break after Field2.

    Originally, I have this issue with ".csv" files containing exported grades from MS-Teams team/class.

    As I don't know how to reproduce this issue on your environment, we can close this issue.

    Byla tato odpověď užitečná?

    Počet komentářů: 0 Žádné komentáře
  4. Miroslav Pragl 79,206 Reputační body Dobrovolný moderátor
    2021-01-10T07:30:18+00:00

    Prosim pis cesky sem, nebo anglicky do EN for.

    dik

    MP

    Byla tato odpověď užitečná?

    Počet komentářů: 0 Žádné komentáře