简体   繁体   中英

How to Read Excel file Uploaded to database without saving the excel to the server using

I have written a code which uploads an excel sheet to the server database. Till uploading it works fine. But my requirement is now to read the excel sheet data from the uploaded file which is already there on the database without downloading it to the server?

byte[] tempContent = GetImage(Name); 
MemoryStream test = new MemoryStream(); 
test.Write(tempContent, 0, tempContent.Length); 
HSSFWorkbook wb1 = new HSSFWorkbook(test); 

The last line errors out "Null Reference Exception was Caught"

The function GetImage(Name) gets the data from the uploaded excel file after matching the file name on the db

There was a problem with the .xls file. Opened and saved it again and it started working. The code worked perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM