Open XLS from a URL

Nov 26, 2014 at 2:57 PM
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.
Dec 17, 2014 at 10: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.