Parsing CSV that's contained in a Table Cell

I am currently making a HTTP request to pull some metadata about a database. The return looks as follows.

I want to load in the body column (single cell) as a table (It is current a CSV format within a table cell). My current solution involves me having to save the table as a CSV, make some manual edits to the CSV file (To remove the table cell formatting) and loading it back in as a CSV to get a Knime table.

The raw CSV writer output looks as follows:

I have to remove the body tag at the top as well as the parentheses around the CSV.

I wanted to ask if there is a way to directly read the table cell as a CSV within Knime without having to save, edit and load the CSV. Thanks in advance for any help.

Hi @vsung , next time, please paste the data as a text so we can copy the data and use it to demonstrate.

You can do a Cell Splitter delimited by “\n”, which will separate each line as separate columns, Transpose these columns into rows, and then do a Cell splitter delimited by “,” to split into columns.

I put something together for you:

As indicated in the comments, the first yellow rectangle simulates the data you retrieved via HTTP Request, and looks like this (I added a few lines only, as I had to type them manually, hence why I suggested you should give the sample data in a way we can just copy it):

After processing, the results look as follows:

I added a 3rd part, which is the 2nd yellow rectangle, where I move the first row as headers:

I was not sure if you wanted the first row as headers or not. If you don’t need it, you can just discard what’s in the 2nd yellow rectangle (hence why I made them easily identifiable)

Here’s the workflow:
Split csv from a cell to rows and columns.knwf (16.5 KB)


Thank you very much. This works perfectly.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.