Fetching data from different .csv files

saromaki

New Member
Joined
May 12, 2009
Messages
27
Hello wizards!

I have a lot of .csv files in a directory and I'd like to combine the values from those into one file.

The filenames have a value (second 6-digit number) that I'd like to use as a header in the main file along with the date they were created on (it's also the first 6-digit number on the filename in format MMDDYY).

Example below:
1633594273731.png


The files have two numbers separated with a comma in A1.
Example below:
1633594331754.png


I'd like to fetch the data from these .csv files into one so that the values are divided into two fields using the second 6-digit number from the filename (e.g. 509209) and the date as headers.
Example below:
1633595021039.png


Is this even possible?

Thank you for your time
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I think the description is not complete.

For the sample 6-digit number, 509209, there are four different CSV files for the same date (and it's the same for the other 6-digit numbers). However, your result sample extracts only one CSV file content. If the other three files had different name signatures, then I would have thought of extracting their content as new rows with the associated dates, however, that's not the case and they belong to the same date.

What is the application logic for the other files that include the same 6-digit number?
 
Upvote 0
You're right, I was being unclear about the wanted output. Let me show you the wanted output for number 509209 (for 5th of Oct. 6th and latter days should be fetched below these accordingly). And having more thoughts the other numbers can be combined similarly to other sheets.


1633677165868.png



If it is possible to sum all the values per day, then that would be the best output...
 
Upvote 0

Forum statistics

Threads
1,223,882
Messages
6,175,165
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top