+ Reply to Thread
Results 1 to 8 of 8

Macro to import large CSV file with condition

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Macro to import large CSV file with condition

    I have a large CSV file with 4 million rows and 256 columns I need to import into Excel.

    However, rather than import the entire CSV file, I would like import only the first row (header row) and all rows have the letters AZ (for Arizona) in column AF. For that matter, is it possible to have an inputbox appear so that I can type in the State abbreviation for the records I wish to extract? (all for column AF). The State abbreviations appear in other columns as well, so it would need to be specific for column AF.

    Thanks.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,464

    Re: Macro to import large CSV file with condition

    See if this works for you.

    Assuming csv file is in the same folder.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Re: Macro to import large CSV file with condition

    CSV file is 4.2 GB in size. Ran the macro and got an "Out of Memory" runtime error after a minute. Sounds like I need a new computer Anyway around this besides that? Thanks.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,464

    Re: Macro to import large CSV file with condition

    String variable can only store up to 2GB as I remember...

    In that case, it needs to read line by line...
    How about
    Please Login or Register  to view this content.
    Last edited by jindon; 09-18-2012 at 12:23 AM.

  5. #5
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Re: Macro to import large CSV file with condition

    Now get an "Run Time error 14...Out of String Space". Any corrections?

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,464

    Re: Macro to import large CSV file with condition

    Do the CSV file actually have Carriage Return chracters?

  7. #7
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Re: Macro to import large CSV file with condition

    Looks like it..at least for the data. You can check out the file at http://nppes.viva-it.com/NPPES_Data_...n_Aug_2012.zip (450MB zip file that unzips to 4GB).

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,464

    Re: Macro to import large CSV file with condition

    Problem...

    I can not even open "npidata_20050523-20120813.csv"....

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1