Dim Book As New XLS.Book("I:\transDetail2021-03-24.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("表D").StopRedraw()
'注意以下数组中列名称的顺序,必须和Excel表中的列顺序一致
Dim nms() As String = {"业务流水号","交易日期","交易时间","借方发生额","贷方发生额","账户余额","凭证种类","凭证号","交易渠道","交易地点","摘要","付款用途","对方账户","对方账户名","对方开户行","附言"}
'注意下面的循环变量从1开始,而不是从0开始,因为Excel表的第一行是标题
For n As Integer = 5 To Sheet.Rows.Count -1
Dim bh As String = sheet(n,0).Text
Dim bi As String = sheet(n,1).Text
If DataTables("表D").Find("业务流水号 = '" & bh & "' and 业务流水号 = '" & bi & "'") Is Nothing Then '如果不存在同编号的订单
Dim r As Row = Tables("表D").AddNew()
For m As Integer = 0 To nms.Length - 1
r(nms(m)) = Sheet(n,m).Value
Next
End If
Next
Tables("表D").ResumeRedraw()
但是现在出现几个问题:
1、导入时间特别长,其实是真正有效的数据只有230多行,但是该报表不知道为什么总行数有20000多行。
2、数据的240行和241行(由数据行确定)是不需要导入的,不知道怎么搞。
3、导入后“表D”里足足有20000多行,请问如何解决。