drawio icon indicating copy to clipboard operation
drawio copied to clipboard

CSV import doesn't work with escaped newlines

Open ChristianLW opened this issue 2 years ago • 1 comments

Preflight Checklist

  • [X] I agree to follow the Code of Conduct that this project adheres to.
  • [X] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Describe the bug

The CSV import utility (Arrange → Insert → Advanced → CSV) breaks when using escaped newlines – escaped newlines being newlines (LF/CRLF) within a cell, where the content of the cell is enclosed in "", similar to if the cell contains a comma or a quotation mark. For example:

First column,Second column,Third column
This is a simple cell,"This cell spans
multiple lines",This is the last cell of the row

To Reproduce

Steps to reproduce the behavior:

  1. Go to Arrange → Insert → Advanced → CSV
  2. Use any valid content which includes at least one escaped newline. For example, you could edit a cell in the placeholder to be surrounded by "" and contain a newline.
  3. When importing, the row containing a cell with a newline becomes two rows that are clearly messed up in some way.

Expected behavior

The newlines are correctly escaped and interpreted as cell content and not a row separator.

Screenshots

In the first image, Edward's shape has become two strange shapes – this is what happens currently. In the second image, Edward's position (Brand Manager) spans two lines – this is the expected result.

image image

draw.io version

21.3.2 (not specific to any version as long as it's recent)

Desktop

  • OS: Windows 10
  • Browser: Chrome 113

The issue happens both in the webapp and in the Electron app.

Additional context

Escaped newlines aren't simply something I'm making up. Excel exports CSV this way, and RFC 4180 describes them.

ChristianLW avatar May 15 '23 19:05 ChristianLW

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. See the FAQ for more information.

stale[bot] avatar May 15 '24 00:05 stale[bot]