Whole (text) file to single cell?

I am trying to find a way to load an entire text file into a single cell for further downstream processing.  I have found a way which works for local files (e.g. C:\myfile.txt) using the JPython Function node, with the code

open(val("column1")).read()

(column1 contains the file path - e.g. 'C:\myfile.txt'), although I'm not sure whether this then leaves python file connections open.

However, it would be nice to have something more universal, similar to the file reader node, which would handle .gz files, and also remote files supplied as urls.  I've tried implementing this in the java snippet node, to no avail, and the above JPython fails for a url, as expected.

Is there any (simple!) way to achieve this?

Thanks

Steve

Hi Steve,

Text files can be loaded into a single cell using the  "Flat File Document Parser" in the  Text Processing suite of nodes. Then you can use the "Document Data Extractor" to convert this into a single String cell.

Is this any use to you ?

 

Simon.

Simon

Thanks for the answer.

Steve