PDA

View Full Version : HELP!!! Importing CSV file into excel based on cell value



Miche25
03-05-2016, 03:28 AM
I am trying to write a macro to import data from 5 separate csv files and import into 5 separate worksheets (i.e Sheet1 through to Sheet5) within my excel workbook.
The thing is, I already have the path and file names of the csv files I would like to import data from in cells A1 to A5 within Sheet6 of the workbook (I want to use cell values so the user can enter the dates of the files to be imported going forward).

The files of which I am importing data from are daily download files with dates in the file name (for example, 20160101.csv) I don't want to have to open these files every week and copy and paste the data into my workbook.

How can I do this?

gmayor
03-05-2016, 11:03 PM
It is difficult to get one's head around this requirement. Can you describe your process in more detail?
Where are the files 'downloaded' from/to? Are they e-mail attachments?
Is that one file per weekday, and does each weekday have its own sheet i.e. does Monday's csv go on sheet1, Tuesday's on sheet2 etc?
You say that you have the paths and filenames on Sheet 6, yet later you say that the files change by date. How is that resolved?
Do you wish to import ALL of the CSV and add it to the end of the appropriate worksheet, or just part of it?
If they are e-mail attachments, the whole process could be automated from an Outlook rule as the messages arrive.
If you are collating the files at the end of the week from hard drive/network then how would you want to initiate the process.