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

前端 未结 15 997
长情又很酷
长情又很酷 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 17:58

    Excel 2007+ is limited to somewhat over 1 million rows ( 2^20 to be precise), so it will never load your 2M line file. I think that the technique you refer to as splitting is the built-in thing Excel has, but afaik that only works for width problems, not for length problems.

    The really easiest way I see right away is to use some file splitting tool - there's tons of 'em and use that to load the resulting partial csv files into multiple worksheets.

    ps: "excel csv files" don't exist, there are only files produced by Excel that use one of the formats commonly referred to as csv files...

    0 讨论(0)
  • 2020-12-07 17:59

    I would suggest to load the .CSV file in MS-Access.

    With MS-Excel you can then create a data connection to this source (without actual loading the records in a worksheet) and create a connected pivot table. You then can have virtually unlimited number of lines in your table (depending on processor and memory: I have now 15 mln lines with 3 Gb Memory).

    Additional advantage is that you can now create an aggregate view in MS-Access. In this way you can create overviews from hundreds of millions of lines and then view them in MS-Excel (beware of the 2Gb limitation of NTFS files in 32 bits OS).

    0 讨论(0)
  • 2020-12-07 17:59

    I was able to edit a large 17GB csv file in Sublime Text without issue (line numbering makes it a lot easier to keep track of manual splitting), and then dump it into Excel in chunks smaller than 1,048,576 lines. Simple and quite quick - less faffy than researching into, installing and learning bespoke solutions. Quick and dirty, but it works.

    0 讨论(0)
  • 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
    
    0 讨论(0)
  • 2020-12-07 18:08

    If you have Matlab, you can open large CSV (or TXT) files via its import facility. The tool gives you various import format options including tables, column vectors, numeric matrix, etc. However, with Matlab being an interpreter package, it does take its own time to import such a large file and I was able to import one with more than 2 million rows in about 10 minutes.

    The tool is accessible via Matlab's Home tab by clicking on the "Import Data" button. An example image of a large file upload is shown below: Once imported, the data appears on the right-hand-side Workspace, which can then be double-clicked in an Excel-like format and even be plotted in different formats.

    0 讨论(0)
  • 2020-12-07 18:08

    I'm surprised no one mentioned Microsoft Query. You can simply request data from the large CSV file as you need it by querying only that which you need. (Querying is setup like how you filter a table in Excel)

    Better yet, if one is open to installing the Power Query add-in, it's super simple and quick. Note: Power Query is an add-in for 2010 and 2013 but comes with 2016.

    0 讨论(0)
提交回复
热议问题