+ Reply to Thread
Results 1 to 4 of 4

Importing multiple csv files using the csv filename as the worksheet name

  1. #1
    Registered User
    Join Date
    11-20-2018
    Location
    Scotland
    MS-Off Ver
    Office 365
    Posts
    4

    Question Importing multiple csv files using the csv filename as the worksheet name

    I need to import multiple csv files into a single workbook with the data as a table using the first row as the headers. I can do this individually using data>from text/csv but I have over one hundred to import. I would also like that the created worksheets have the tab name the same as the csv filename. I can do a multiple query using get data from file but again this just gives me a list sheet1 - sheet127 which gives me no idea what data is in what sheet.
    Is this a wish too far? I would be happy to use a macro if this is what is required.
    My source for the get data from file option is a workbook with all the csv files imported to named tabs using ablebits tool (data is not a table) but I would be just as happy to be able to achieve this from the csv files directly.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Importing multiple csv files using the csv filename as the worksheet name

    Look at this video on how to use Power Query to import all csv files from a single folder

    https://www.youtube.com/watch?v=pMQK1Zcc9jw
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Importing multiple csv files using the csv filename as the worksheet name

    Don't use the From Text/csv option, use the From Folder option to combine csv files into one sheet.

  4. #4
    Registered User
    Join Date
    11-20-2018
    Location
    Scotland
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Importing multiple csv files using the csv filename as the worksheet name

    Thanks guys but both your suggestions are for combining multiple files into a single worksheet.
    I need a separate sheet for each file named after the source file not including the extension.

    for example for files a.csv to z.csv I need a workbook with tabs named a to z with the data in table format first row as header.

    each csv file is an extract from a database table (no I do not have access to the actual db that it came from) and thus has a different set of data and a different number of columns and rows.

+ 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] Importing Multiple CSV Files Into One Worksheet
    By GrimeyOne in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2018, 11:53 AM
  2. Importing multiple .txt files into a single worksheet
    By subash24584 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-04-2012, 09:02 AM
  3. [SOLVED] Importing multiple csv files, adding filename to each row and removing the header
    By Telving in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-25-2012, 12:59 PM
  4. Importing multiple text files into one worksheet
    By gwatcheater in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-11-2012, 12:30 PM
  5. importing multiple text files into one worksheet and one column
    By hluk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-16-2010, 10:03 PM
  6. Replies: 3
    Last Post: 03-12-2006, 06:00 AM
  7. Replies: 4
    Last Post: 07-15-2005, 06:05 AM

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