Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Import multiple excel files and include file name

Import multiple excel files and include file name

Import multiple excel files and include file name

Can anyone help, i need to import multiple Excel file to an access table, all the same fields, but when they import it adds the file name to a new colmun in the table...

The files are imported weekly, around 50-60 of them

Thanks in advance....

RE: Import multiple excel files and include file name

1. You need to review how to use this site properly. I looked at your profile. You've asked questions, but never really let folks know what did or did not work. If you did, I certainly could not tell.
2. If you're using Access, there are MS Access specific forums of which you're aware, due to your user profile showing you've asked questions there.
3. This is most likely going to be done via VBA, so I'd specifically recommend forum705: Microsoft: Access Modules (VBA Coding)

That said, the general idea of what you want to do is:
1. Loop through all files in a folder (I'm assuming the files are in one place): Usually easiest way to do this is with the FileSystemObject.
2. For each file, check if is an Excel file: easiest way, I think, is to check the file extension.
3. Then if they are the exact same format, with little to no irregularity, you can use the TransferSpreadsheet command to import the data from each workbook/worksheet.

I'd add that if this is a routine thing, you definitely spend some time adding some error checking, b/c eventually something will not be correct. I'd check the file name, I'd check at least some values in the data before importing to make sure an invalid file with the proper file name didn't get dumped in. And perhaps you might want to do some checking around filtering out possible duplicate data.

"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57

RE: Import multiple excel files and include file name

Blimey someone has got out the bed the wrong side this morning....

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close