I need to import the data from a .csv file selected by the user to my database
This is my code:
private static final int COD_SELECCIONA_TXTCLI = 12;
private static final int COD_SELECCIONA_XLSCLI = 13;
private String myPath;
public void elegirArchivoExcelCliente(View vista) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("text/*");
try {
startActivityForResult(Intent.createChooser(intent, "Elige una aplicación"), COD_SELECCIONA_XLSART);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode){
case COD_SELECCIONA_XLSART:
datos = data.getData();
myPath = String.valueOf(datos);
break;
}
}
How can I import the data from that .csv file that the user selected to my database?