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-21T08:05:00+00:00

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

    Počet komentářů: 0 Žádné komentáře
  2. Anonymní
    2021-01-20T21:44:18+00:00

    Ad fórum: jj, adresní řádek jsem tipl, ale stejně netuším, jak se dostat do anglické mutace, tohle je místo, kam mne to nativně směruje při přihlášení.

    Ad dotaz: Ne, chová se to stejně špatně i u toho, co posílal on (jak jsem odpovídal). Pročetl jsem stackoverflow a další dotazy a dospěl jsem k názoru, že je to problém s lokalizací Excelu. Přiznám se, že nemám čas to moc dál řešit, takže nejméně bolestná cesta je (bohužel) přes google spreadsheets, který to umí převést korektně. Je to škoda.

    Ale každopádně děkuji za pomoc.

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

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