I am reading a txt file and writing it into excel file, but while making it as downloadable excel file it is not writing any data to excel and giving showing this message
I would strongly discourage implementing this on your own, since you are very likely forget some special cases, for example concerning different separators, special characters, ...
Instead, use one of the many existing libraries for that.
Your writeDataToExcelFile
method writes the Excel data into a FileOutputStream - this is not connected to the response OutputStream.
You should update the writeDataToExcelFile
method to include another parameter:
private void writeDataToExcelFile(String string,
ArrayList<ArrayList<String>> excelData,
OutputStream outputStream)
and the writing of the data, change to this:
myWorkBook.write(outputStream);
This should then permit the myWorkBook object to write back to the browser.
Also, change the line that calls the method to:
writeDataToExcelFile("praveen",exceldata, response.getOutputStream());