Recommand · June 11, 2021 0

How to download and read from an Excel file using AsyncHttpClient in Android

I what to use my online Excel database to populate my recycler view, but when I run my app the file it cannot be downloaded, it always returns the onFailure() method as in code. I test the app on an Android 4.4 kitkat phone with internet connection.

    client = new AsyncHttpClient();

    //Download link for my database
    String db = "";

    //Download database and save it in file
    client.get(db, new FileAsyncHttpResponseHandler(this) {
        public void onFailure(int statusCode, Header[] headers, Throwable throwable, File file) {



        //After  Download completition
        public void onSuccess(int statusCode, Header[] headers, File file) {
            WorkbookSettings wbs = new WorkbookSettings();

            if(file != null){

                try {

                    datab = Workbook.getWorkbook(file);
                    Sheet sheet = datab.getSheet(0);

                    //get rows available in our sheet
                    for(int i = 0; i < sheet.getRows() ; i++){

                        //store the rows in an array
                        Cell[] rows = sheet.getRow(i);

                        //then each row is stored accordingly

                } catch (IOException e) {
                } catch (BiffException e) {


public void fail(){
    Toast.makeText(this, "Failed to connect to the server", Toast.LENGTH_LONG).show();

public void passed(){

    Toast.makeText(this, "Please wait while processing results", Toast.LENGTH_LONG).show();

The link you are using does not exist (publicly?). You always end up in onFailure() because there is no file associated with the link. The repository needs to be public.