I am developing an android app in netbeans. I am trying to read CSV file using opencsv. When I put the file in resources folder and try to read it from there, there's an error while building saying invalid resource directory. Where should I store csv file so that it can be read each time the app starts?
You can import a CSV file into SQLite table by using sqlite3 tool and . import command. This command accepts a file name, and a table name. Here, file name is the file from where the data is fetched and the table name is the table where the data will be imported into.
Opening a CSV file is simpler than you may think. In almost any text editor or spreadsheet program, just choose File > Open and select the CSV file. For most people, it is best to use a spreadsheet program. Spreadsheet programs display the data in a way that is easier to read and work with than a text editor.
Reading a CSV File in Kotlinget("/resources/students. csv")); Then, once we've read the file into the buffer, we can use the buffer itself to initialize a CSVParser instance: val csvParser = CSVParser(bufferedReader, CSVFormat.
you should put csv file in assets folder ..
InputStreamReader is = new InputStreamReader(getAssets()
.open("filename.csv"));
BufferedReader reader = new BufferedReader(is);
reader.readLine();
String line;
while ((line = reader.readLine()) != null) {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With