How can I import multiple .csv files into access?

A

Athlonman

I have an issue where I have a machine that will generate 1000+ .csv files
with new file names each day. The file structure is month\day\test
name\*.CSV. I have little to no experiance using Access but I have a
customer that is needing two weeks worth of data off of this machine and my
high end method of copy and paste is not getting it fast enough for them.
Can this be done in Access. If so can you explain it to a newbie?

Thanks
 
G

gllincoln

Hi,

Access can do this but it takes a litle time and works a lot smoother if you
have at least intermediate level experience.
Since this is a one time thing - Acess may not be the best way to go.

I'm having some difficulty getting a handle on what you are describing. Are
we talking about 1,000 rows of data in one file per day or 1,000 files per
day???

Do you need to select only the client's files amongst a lot of other stuff
or does the client want all of the files from the past two weeks for this
machine?

Are all of the files in the same format - contain exactly the same headers
(if any) and number of columns etc?

I will assume that we are talking about 1 file per day for a moment, located
at month\day\test name\*.CSV

One low tech, extremely high powered way to deal with this exact scenario -

Use the CLI copy command to concatenate the files into one file - if the
files contain headers (names of the columns at the start of each file) -
you can open the file with notepad, use the Ctrl-F search tool to find the
headers - and delete all but the very first row of headers. Voila - big two
week file ready to ship off.

If you are at all familiar with the old DOS days ways, and using batch
files, then you know exactly what I am talking about.

I will assumethat you haven't done something like this before.

Rather than explain the ins and outs of batch files I will explain this the
slightly longer but safer way.

Open up a terminal window (type CMD in the run box from the start menu).

the copy command syntax is copy [source] [target]
allows you to copy a file to another location - example
copy C:\myfolder\filea.txt H:\myfolder

you can also use the copy command to rename the file at the same time

copy C:\myfolder\filea.txt H:\myfolder\newname.txt

When you are working with text or csv or tsv files, copy does something else
useful; it can combine several files into one.

copy [source1] + [source2] + [source3] mynewfile.txt

if the order that the files appear isn't important, then you could chop this
into steps however you wish.

copy [source1] + [source2] + [source3] + [source4] + [source5] myweekone.csv
copy [source6] + [source7] + [source8] + [source9] + [source10]
myweektwo.csv
copy myweekone.csv + myweektwo.txt mytwoweek.csv

If the order matters, it might be easiest to open the final file in Exel,
sort the file on the field that contains the sequence id or timestamp or
whatever.
The sorting would also put all the header rows together - so you could kill
all but one of them, bring the header to the first row, save as *.csv comma
separated values file and you have something you can send to your client.

Hope this works for you.

Gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top