+ Reply to Thread
Results 1 to 8 of 8

Export Each Excel Row as Separate Files with Header Row

  1. #1
    Registered User
    Join Date
    07-21-2016
    Location
    Discovery Bay, CA
    MS-Off Ver
    Office 2010
    Posts
    17

    Export Each Excel Row as Separate Files with Header Row

    Ladies and Gentlemen, I'm stumped and would appreciate your expertise. I have researched this here and elsewhere, but the answer eludes me.
    Summary: I just want to export each row of an Excel file to a new file, but I must have the same header row for each file. Also, some cells are blank, but they still must be included.
    Details:
    Excel Worksheet with 13 Columns (A-M) and 11 Rows (1-11)
    Row 1 is the header row which must be included in each file
    Contents of each row must be exported to a new file
    Column A for each row is used for the name of the new file
    If any Cells are blank, EXCEPT Column 1, they still must be included in the new file.
    Script should continue until a blank value in Column A
    I need to be able to code the directory for the output.
    I will attach what I have so far - not elegant, it works, but does not give me what I need.
    It only takes the individual row with no header and exports to the directory where the workbook is open.

    Please Login or Register  to view this content.


    Worksheet.jpg
    Attached Files Attached Files
    Last edited by JBeaucaire; 07-21-2016 at 10:46 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Export Each Excel Row as Separate Files with Header Row

    It looks like you want to save each row plus header as a comma-delimited file using the filename in column A?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    07-21-2016
    Location
    Discovery Bay, CA
    MS-Off Ver
    Office 2010
    Posts
    17

    Re: Export Each Excel Row as Separate Files with Header Row

    Exactly - that is correct!

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Export Each Excel Row as Separate Files with Header Row

    Ok, then this macro created the attached AU files.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-21-2016
    Location
    Discovery Bay, CA
    MS-Off Ver
    Office 2010
    Posts
    17

    Re: Export Each Excel Row as Separate Files with Header Row

    Outstanding! That is almost it! There are only 2 items - need quotes around each value, and the values in Column A should not be included in the output.
    Can that be done?
    Here is an example:

    "System_ID","type","command_line","Max_Time_Allowed","time_limit_action","Max_Score","Core_Vendor","System_Vendor","File_name","Mastery_Score","Web_Launch","AU_Password"
    "A001","SampleAU",,,,"100","F_FWD=1<CR>DEBUG=1<CR>EXIT_URL=http://blahblahblah.org/pages/done_sl.html<CR>","STUDENT","https://www.blahblahblah.com/5789","100",,

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Export Each Excel Row as Separate Files with Header Row

    Ok, there is no inherent comma+quotes delimited CSV format, so we have to fake it. This is two functions now.
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 07-22-2016 at 07:46 PM.

  7. #7
    Registered User
    Join Date
    07-21-2016
    Location
    Discovery Bay, CA
    MS-Off Ver
    Office 2010
    Posts
    17

    Re: Export Each Excel Row as Separate Files with Header Row

    When I get home, I shall try this and let you know. Thank you so much!

  8. #8
    Registered User
    Join Date
    07-21-2016
    Location
    Discovery Bay, CA
    MS-Off Ver
    Office 2010
    Posts
    17

    Re: Export Each Excel Row as Separate Files with Header Row

    You, Good Sir, are awesome!!! Works perfectly!
    Thank you so much for your help, and I learned a few new things. Problem Solved!

+ 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. [SOLVED] writing excel file to separate tab separated text files with header in each
    By gsindby in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-15-2014, 10:19 AM
  2. Export Columns to separate Text files
    By murtly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2014, 08:25 AM
  3. Simple Macro to Export Each Cell as Separate Files
    By Moop in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-16-2013, 12:55 PM
  4. Export each row to separate TXT (header row always included)
    By tvancoillie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-14-2012, 04:28 AM
  5. Replies: 0
    Last Post: 11-09-2009, 09:57 AM
  6. split it into groups of 100 and export it to separate .csvs or text files
    By Shaunclippo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2006, 01:40 PM
  7. Open Excel files in separate sessions, not just separate windows?
    By Bob at Dexia Design in forum Excel General
    Replies: 1
    Last Post: 10-18-2005, 01:05 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