This project is read-only.

Open XLS from a URL

Nov 26, 2014 at 3:57 PM
Hello,
I am using the NPOI 2.1 version. I am trying to open a XLS file from a URL, but I am getting a NotSupportedException. Here's my code:

HSSFWorkbook wb;

System.Net.HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ssFileName);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

wb = new HSSFWorkbook(response.GetResponseStream());

Is there any other way to implement this?

Thank you.
André
Dec 17, 2014 at 11:01 PM
Please make sure the downloaded xls file is a real Excel. If it's a html-based Excel file, it will not be recognized by NPOI. You can save the response result to a file first to check what's going on.