0

How can I read an Excel file stored on an application server?

I have read this and most of the solutions which I have gone through show to read it from a physical location of the local computer.

I would like to read it from an application server. Can someone suggest how to achieve this?

Community
  • 1
  • 1
Sam
  • 2,352
  • 4
  • 32
  • 45

2 Answers2

6

You can use Apache POI for read the file. e.g.:

InputStream inputStream = new URL("http://localhost/report.xls").openStream();

//Get the workbook instance for XLS stream
HSSFWorkbook workbook = new HSSFWorkbook(inputStream);

See also Read / Write Excel File In Java Using Apache POI.

Paul Vargas
  • 41,222
  • 15
  • 102
  • 148
0

You really have two different problems: reading the excel spreadsheet and reading a file from a server. I doubt you're going to find a tool for both. I would download the file to a temporary file and then read that using your Excel reader. Divide and conquer.

Thom
  • 14,013
  • 25
  • 105
  • 185
  • Isn't it possible to read the file directly from application server and not downloading as a temporary file? Probably something in-memory? – Sam Jan 13 '14 at 14:01
  • Would make sense. Would make sense that someone wrote a library to read a remote resource as a file. Problem is the way his JDBC solution works. Anyway, don't know how to do any of that. – Thom Jan 13 '14 at 14:18