Converting Anvil Media Object - dos2unix

I want to upload a CSV to Anvil using file loader, and been having issues with the source file being windows CSV so it breaks the import.

What would be the best way to address converting this to a unix format? If I can convert it, i’d like to be able to parse with pandas to make it simple to import into data tables.

Also I want to convert in the app, instead of adding additional steps to the user.

Welcome back, @sales !

When you say “Windows CSV”, what specific problem(s) are you referring to? Line endings? Character encoding? Etc. How, exactly, is the actual CSV different from the desired CSV?

Different problems call for different solutions.

It’s a csv from a windows filesystem, so if I try to pass it to pandas it seems to break and doesnt understand the format.

So I was looking for a quick way to pass the media object to the server, then fix the line breaks and then pass it to pandas.

First thoughts was to fix it and then repack into a media object then pass that to the db import function…

The format of the file (sequence of bytes) depends on the program that generated it, not on the filesystem. So the original question is still relevant.

Does this post answer your question? Or does it at least clarify what Anvil can do with CSV?

Yes it does. I ended up processing it out and parsing the data before uploading to the database. So problem solved. thank you

1 Like