+ Reply to Thread
Results 1 to 5 of 5

taking data from multiple .csv files and putting them into one spreadsheet

  1. #1
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    taking data from multiple .csv files and putting them into one spreadsheet

    I have 400 individual .csv files that I would like to assemble into one spreadsheet, where the data from each csv file would go into an individual tab of the spreadsheet. Thus, the spreadsheet will end up with 400 different tabs. Is this possible to do by somehow extracting the data without having to open each individual csv file one by one and only then doing copy and paste? Just looking for the fastest way to get the job done.

    Thank you.

    PS: Here ares some more details, in case you may find them helpful:

    Each csv file has historical data for a stock symbol, 7 columns by approximately 100 rows. The main spreadsheet will have a list of the 400 symbols in one of the tabs, in one column. What I'd like to be able to do is import all of the csv files into this spreadsheet and have a sub that first creates a tab for an individual stock symbol (the tab's name will be the stock symbol, like MSFT, YHOO, etc.) and then copies the data from a csv file of that stock (the csv file's name is the stock symbol, such as MSFT, or YHOO, etc.) into the appropriate tab.
    You either quit or become really good at it. There are no other choices.

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: taking data from multiple .csv files and putting them into one spreadsheet

    Here's a web page that can get you started.
    David
    (*) Reputation points appreciated.

  3. #3
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    Re: taking data from multiple .csv files and putting them into one spreadsheet

    I've spent some time looking at the code, but could not quite follow it completely as my knowledge in vb is at a somewhat novice level

    is this the portion of the code that loops through the sheets and extracts the data from csv files?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: taking data from multiple .csv files and putting them into one spreadsheet

    Yes it is. Is there a specific question?

  5. #5
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    Re: taking data from multiple .csv files and putting them into one spreadsheet

    Ok, cool, thanks. Let me finish the whole thing and see how and if it works....

    ---------- Post added at 07:45 PM ---------- Previous post was at 05:57 PM ----------

    I've tried to simplify this as much as possible. The individual file names are in cells A1:A3 (without the ".csv" ending) and the workbook name where the code is located is "cvs import test.xlsm"; the .csv files and "cvs import test.xlsm" workbook are in the same directory.

    Here's what I have so far, which gives me a subscript out of range error at the "Set mybook = Workbooks.Open(CSVFileNames(Fnum))" line of code. What do I need to tweak to make this work?:

    Please Login or Register  to view this content.

+ 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