How to read dat file

SK8-0411.xlsx (16.7 KB)
SK8-0411 - Copy.txt (9.2 KB)

The raw file is txt file, we want to save excel file,
how to do

I’m struggling with how your txt file is formatted. Do you have any idea what the column delimiter(s) might be? I’ve tried various options in the CSV Reader node and looked with Notepad++ and can’t figure it out.

1 Like

Text is CSV with TAB as column separator. KNIME: File Reader (Encoding: UTF-8), followed by a Cell Splitter. Now the trick is to get the delimiter definition in the Cell Splitter done. Open your txt with an advanced editor like Notepad++, show the “invisible” characters and copy a tab (arrow from left to right) in the clipboard. Paste this single character now into the delimiter field in the Cell Splitter configuration and you’re done.
The output is not pretty but it is a table and so you can follow up with e.g. an Excel Writer.

3 Likes

Expanding on @McReady’s suggestion, if you replace the File Reader with a Line Reader, and ensure you set it to “use fix column header”, it will preserve the additional column spacing which gets lost with the File Reader:

You can also denote tab in Cell Splitter by using “\t” and ticking the “use \ as escape character”:

image

4 Likes