我正在寻找上传一个excel文件,打开它并阅读每一行,并可能删除该行,具体取决于一个单元格是否包含某些值。
我已经有上传工作:
Protected Sub ButtonUploadFile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonUploadFile.Click
If FileUploadExcel.HasFile Then
Try
FileUploadExcel.SaveAs(Server.MapPath("~/ExcelImport.xls"))
LabelUpload.Text = "Upload File Name: " & _
FileUploadExcel.PostedFile.FileName & "<br>" & _
"Type: " & _
FileUploadExcel.PostedFile.ContentType & _
" File Size: " & _
FileUploadExcel.PostedFile.ContentLength & " kb<br>"
Catch ex As Exception
LabelUpload.Text = "Error: " & ex.Message.ToString
End Try
Else
LabelUpload.Text = "Please select a file to upload."
End If
End Sub
所以我现在有它叫做 ExcelImport.xls
Dim oExcelApp As Excel.Application = Nothing
Dim sFileName As String = "~/ExcelImport.xls"
这是据我所知......但对其余部分并不完全确定。
有任何想法吗?
谢谢,