You not always can create a working file from a content URI. But you likely don't need it. new CSVReader(fr); accepts a Reader as a parameter. You can use InputStreamReader, created from the InputStream, created from the Uri using following method:
InputStream inputStream = getContentResolver().openInputStream(uri);
where uri is data.getData()
applications - How to open .csv file on Android? - Android Enthusiasts Stack Exchange
How read csv file from internal storage
Best practice: Downloading CSV file to internal storage
Options to read CSV external file into App
Videos
There are file explorer style apps that will open it. Or you could download Csv Viewer app from Play Store.
Blurb from it.
CSV File Viewer For Android | CSV Reader - view small and large-sized CSV files.
CSV Reader - Simple, fast, and powerful tool for reading csv files.
I am not associated with it.
Any office suite should be able to open it. I recommend using CollaboraOffice (https://play.google.com/store/apps/details?id=com.collabora.libreoffice&hl=en_US), I successfully opened .csv files with it in table format and can also edit it. The app has no ads and it is open source.
(I am not promoting/endorsing the app)
I am working on updating an existing "rolodex" app.
-
It reads the values from an internal .csv file and displays them in a list view.
-
Asynchronously reads an updated csv files from a url to display in the data in same list view.
Issue: If user isn't connected to the internet, they are presented with the outdated csv file.
What would be the best way to download the updated CSV file to make the data available for the user when they are offline?