How to arrange this

I have text file i separated columns based on comma ,
I got in this way

I want this in this way
reviewer Id name text helpful
12323 hgdge this is not working 3
i.e each row contains column names i have to make table in such a way where column names must be as column header and no row contain column name in its cell
and some errors are show how to overcome them
Please can someone help me with
Thank You

could you import an example csv (few line input file) and give a clear result that you want to achieve?

— Robert

Yup sure
try.txt (49.6 KB)
this is my file
i want to achieve a table with column headers (reviewerID , asin , reviewerName …)
and respective values in each row

You can use the JSON nodes for parsing. Just process each row as separate JSON object. Then use JSON Path node to extract the required properties.

You can use “file reader”+“string to json”+“json path”.
File reader with:

  • column delimiter = none
  • advance/quote support/currently set quotes = disabled/empty

txt_to_json.knwf (28.0 KB)

— Robert

1 Like

This working well but my file has 25 rows and table is showing all 25 rows with Huge garbage data in table how to remove that garbage data
Please help me

I toyed around with the example a little bit and came up with the following solution. Which is:

  • Import the Text file as one large column width: 500
  • convert the column into JSON
  • manually define JSON paths for each column (or see if the default setting does the trick)
  • remove the “column*” columns
  • export the resulting data with headers

I now have a few empty lines but maybe that was the case if not they could be removed.
If data is missing it could be feasible to expand the width.

Then if you have garbage in your data it could be because of UTF-8 encoding. I had a similar problem and had to change a setting in the knime.ini (until KNIME would have fixed a problem). If you still experience this problem I could try to look up the solution I got.

txt_to_json.knwf (250.4 KB)


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