Excel CSV. file with more than 1,048,576 rows of data

前端 未结 15 1001
长情又很酷
长情又很酷 2020-12-07 17:44

I have been given a CSV file with more than the MAX Excel can handle, and I really need to be able to see all the data. I understand and have tried the method of \"splitting

15条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 18:00

    I found this subject researching. There is a way to copy all this data to an Excel Datasheet. (I have this problem before with a 50 million line CSV file) If there is any format, additional code could be included. Try this.

    Sub ReadCSVFiles()
    
    Dim i, j As Double
    Dim UserFileName As String
    Dim strTextLine As String
    Dim iFile As Integer: iFile = FreeFile
    
    UserFileName = Application.GetOpenFilename
    Open UserFileName For Input As #iFile
    i = 1
    j = 1
    Check = False
    
    Do Until EOF(1)
        Line Input #1, strTextLine
        If i >= 1048576 Then
            i = 1
            j = j + 1
        Else
            Sheets(1).Cells(i, j) = strTextLine
            i = i + 1
        End If
    Loop
    Close #iFile
    End Sub
    

提交回复
热议问题