+ Reply to Thread
Results 1 to 11 of 11

Export Sheets to Text Delimited CSV file

  1. #1
    Registered User
    Join Date
    05-07-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    55

    Export Sheets to Text Delimited CSV file

    Hello,

    I have a macro that combines all worksheets to a single sheet and then exports the data as a text delimited (e.g. "Text","Text2","Text3") format. I am now to a point to where the amount of data I have to merge exceeds the max number of rows that Excel allows (1,048,576). I am trying to find how I can take each sheet and export directly into a single text delimited CSV file without doing the merging in excel. From what I've read, CSV files can handle more than the 1 million rows. Each sheet has a header, so I would only need the header copied into the CSV file one time and all other sheets just row 2 down (Columns A, B, C, D, E).

    Anyone know of a way to do this without merging sheets in Excel before exporting?

    Thanks for any help given.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Export Sheets to Text Delimited CSV file

    Is that mean that you would like quotation marks with every sample of data, or only with text ?
    And numbers without quotation marks ?

  3. #3
    Registered User
    Join Date
    05-07-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    55

    Re: Export Sheets to Text Delimited CSV file

    Hi Porucha,

    Yes, quotations marks for every sample of data. So basically, in the export, the data would look something like:

    "FeeSchedule","Code","Grouper","AllowedAmount","LocationCode"
    "TEST1","80046","","15.53",""

    One thing to add, there are other sheets within that should not be exported to the file (e.g. SETUP, FSNames), so only sheets not equal to sheets specified. Tried to attached a sample workbook, but for some reason it is not giving me the option.

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Export Sheets to Text Delimited CSV file

    Quote Originally Posted by matrix2280 View Post
    ... Each sheet has a header, so I would only need the header copied into the CSV file one time and all other sheets just row 2 down (Columns A, B, C, D, E) ...
    Are the headers of all sheets the same ?
    It is more convenient to take data from a given sheet in its entirety, simpler code.

  5. #5
    Registered User
    Join Date
    05-07-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    55

    Re: Export Sheets to Text Delimited CSV file

    Yes the headers would be as follows for those being exported


    "FeeSchedule","Code","Grouper","AllowedAmount","LocationCode”

  6. #6
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Export Sheets to Text Delimited CSV file

    maybe i understood you correctly, check:
    Please Login or Register  to view this content.
    between the tables with data and other entries in the sheet, a gap of one row and one column must be kept
    exclusions for worksheets: "FSNames" and "SETUP"

  7. #7
    Registered User
    Join Date
    05-07-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    55

    Re: Export Sheets to Text Delimited CSV file

    WOW! That is exactly what I needed and worked perfectly (haven't tested it on the large data set yet, but should work for what I am doing).

    Thank you so much porucha - your help is greatly appreciated.

  8. #8
    Registered User
    Join Date
    05-07-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    55

    Re: Export Sheets to Text Delimited CSV file

    Porucha,

    The Macro works awesome, however, not sure if there is anything that could speed it up (if possible)?

    Once I imported all of the data to give it a full test run, I have a total of 113 sheets to be exported, and each has around 15,000 rows of data (not exact number, but approximately based on the current file I am working with - could be more/less). I ended up stopping the macro after about an hour of running which left about 59 sheets remaining to export to the file which was now at 30MB.

    If not really a way to speed it up, I'll just add in a form to have the user wait until finished.

    Thanks for any additional help

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Export Sheets to Text Delimited CSV file

    Have you tried Power query? It can handle over millions of rows as it is saved on memory.

  10. #10
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Export Sheets to Text Delimited CSV file

    Quote Originally Posted by matrix2280 View Post
    ... is anything that could speed it up (if possible)? ...
    You can try to replace the code snippet (with 'For ... Next' loops) with this one:
    Please Login or Register  to view this content.
    However, I don't think it would help a lot. The code is so simple that there is not much to change (simply, a lot of data to be processed).
    You could also check, what unnecessary services occupy the memory of a given computer and turn them off or check the idea of AB33 as above.

  11. #11
    Registered User
    Join Date
    05-07-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    55

    Re: Export Sheets to Text Delimited CSV file

    Porucha,

    Thanks. Yeah it is a lot of data that I am working with so I wasn't sure.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 05-23-2017, 03:34 PM
  2. Export to Tab-Delimited Text File Not working!
    By AGALLEGOS in forum Excel General
    Replies: 1
    Last Post: 09-17-2014, 11:20 AM
  3. Combine Excel Sheets (+2 Million Rows total) and Create Pipe Delimited TEXT File
    By kestefon in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-05-2013, 08:51 PM
  4. Export to comma delimited text file - formatting data issues
    By jekramak in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-16-2013, 02:30 PM
  5. [SOLVED] Why can't I Export selected cells to tab-delimited text file?
    By Lisa B. in forum Excel General
    Replies: 2
    Last Post: 11-28-2005, 01:40 PM
  6. Export excel file to semicolon delimited text file
    By capitan in forum Excel General
    Replies: 5
    Last Post: 04-06-2005, 11:07 PM
  7. Export excel file to semicolon delimited text file
    By capitan in forum Excel General
    Replies: 5
    Last Post: 04-06-2005, 11:07 PM

Tags for this Thread

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