hr0m
hr0m

Reputation: 2805

How to read a CSV from a string?

I have some data in a csv format. However they are already a string, since i have got them from an HTTP request. I would like to use Data Frames, in order to view the data. However i don't know how to parse it, because the CSV package only accepts files, not Strings.

One solution would be to write the content of the String into a file, and then to read it out again. But there has to be a better way!

Upvotes: 5

Views: 814

Answers (1)

hr0m
hr0m

Reputation: 2805

Use IOBuffer(your_string):

CSV.read(IOBuffer(your_string), DataFrame)

Upvotes: 9

Related Questions