Perspective File Upload cvs files

Hi,
Which is the best way to import a csv file into Perspective?
Using the File Upload object we can get the file Bytes, but how can we convert the Bytes back to a Column/Row kind of structure?
We also try to use python’s csv library, but apparently this library needs to read the file itself, it doesn’t seem to be able to receive Bytes as input.
Also, the File Upload object returns the file name, but just the file name not the file path, so if we try to use the file name as input for the csv library, it would not find the file without the file path.
By the way, it would be nice for the File Upload event.file object to have also a “filepath” field.
I’ll appreciate your suggestions
Thanks!

There are a lot of options, but Python’s csv module natively accepts any iterator of lines - so one easy option is something along these lines:

from java.lang import String
dataAsString = String(event.file.bytes, "utf-8")
csv.reader(dataAsString.split("\r\n"))

Java’s String class has a constructor that accepts a byte[] and a charset for encoding.