Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am trying to upload an excel file . I am using AngularJS + MVC. The view is an html file and the file upload is simple html file upload. After uploading the file , when i click a button, i must be able to access the excel file in the MVC controller.


How can i achieve this?

Thanks
Posted

1 solution

I've used NPOI and it's quite simple to use:
Using Xlfile As FileStream = New FileStream(FileName, FileMode.Open, FileAccess.Read)
Using XLBook As HSSFWorkbook = New HSSFWorkbook(Xlfile)
Using XLSheet As NPOI.SS.UserModel.Sheet = XLBook.GetSheetAt(0)

Dim CurrentRow As NPOI.HSSF.UserModel.HSSFRow
Dim CurrentCell As NPOI.SS.UserModel.Cell
Dim RowEnum As IEnumerator = XLSheet.GetRowEnumerator()

While RowEnum.MoveNext
If (RowEnum.Current IsNot Nothing) Then
CurrentRow = TryCast(RowEnum.Current, NPOI.HSSF.UserModel.HSSFRow)
Select Case CurrentCell.CellType
Case NPOI.SS.UserModel.CellType.STRING
' CurrentCell.StringCellValue
Case NPOI.SS.UserModel.CellType.NUMERIC
' CurrentCell.NumericCellValue.ToString()
End Select
End While
End Using
End Using
Xlfile.Close()
End Using
 
Share this answer
 
Comments
Arjun Menon U.K 1-Aug-14 9:08am    
How can i get the filename and all?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900