Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 13th, 2004, 05:03 PM
Lenore Lenore is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 Lenore User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Can I import all excel files in a directory to Access

I have a database set up that will require bi-weekly updates of more than 30 spreadsheets. I have figured out how to create a macro to import one file and append it to my data table, but I cannot figure out how to import/append an entire directory of files at one time. It would be extremely manual/time consuming to import each file individually especially given the frequency of updates.

I've got my fingers crossed that there is a way to automate this process. Help!

Thanks for any advice/instructions you can offer!!

Reply With Quote
  #2  
Old July 13th, 2004, 05:53 PM
EiSa EiSa is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Norway
Posts: 184 EiSa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 24 sec
Reputation Power: 7
Have never done it, but I think you should look into TransferSpreadsheet Action. You will find information about it in Access help.
__________________
Strictly CSS | Poker Cognac XO

Reply With Quote
  #3  
Old July 14th, 2004, 09:17 AM
Lenore Lenore is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 Lenore User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
TransferSpreadsheet Action

I have explored this option and it allows me to import one spreadsheet but not an entire directory.

For now, I have come up with a work-around using a long macro that will in succession import each file in the directory assuming I consistently name them. It was tedious to create, but for now it's a lot better than manually importing each file.


Quote:
Originally Posted by EiSa
Have never done it, but I think you should look into TransferSpreadsheet Action. You will find information about it in Access help.

Reply With Quote
  #4  
Old July 15th, 2004, 05:50 AM
ineuw ineuw is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 82 ineuw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 28 sec
Reputation Power: 5
If you don't have VBA programming skills, it's best that you define one macro with the "TransferSpreadsheet" action of the macro as many times as needed. This is quick and dirty.

VBA can do it elegantly and in a sophisticated fashion through a form and a listbox in which you select spreadsheets randomly and the target table. However, this requires good knowledge of VBA and the Office reference library installed.

In either case, it's strongly recommended that the spreadsheets have identical field names (column names) and the data types are identical.

Reply With Quote
  #5  
Old July 15th, 2004, 08:41 AM
Lenore Lenore is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 Lenore User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Can I import all excel files in a directory to Access

I figured that would be the case. I'm preparing to take some classes on VBA soon, so hopefully in the future I can revise my methods! For now, the work-around is doing what I need and it wasn't too difficult to set up. All of my spreadsheets have identical field names and data types as well as the same tab name which made setting up the macro go even more smoothly.

Thanks for all the responses!

Quote:
Originally Posted by ineuw
If you don't have VBA programming skills, it's best that you define one macro with the "TransferSpreadsheet" action of the macro as many times as needed. This is quick and dirty.

VBA can do it elegantly and in a sophisticated fashion through a form and a listbox in which you select spreadsheets randomly and the target table. However, this requires good knowledge of VBA and the Office reference library installed.

In either case, it's strongly recommended that the spreadsheets have identical field names (column names) and the data types are identical.

Reply With Quote
  #6  
Old May 16th, 2005, 02:03 PM
hillybd hillybd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 1 hillybd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 15 sec
Reputation Power: 0
Lightbulb I'm in need of a macro just like that.

Hi Lenore,
I wanted to know if you can send me that macro that imports one file and appends it to a data table.
My Email:hillel@glsecurities.com

Thanx.

Quote:
Originally Posted by Lenore
I have a database set up that will require bi-weekly updates of more than 30 spreadsheets. I have figured out how to create a macro to import one file and append it to my data table, but I cannot figure out how to import/append an entire directory of files at one time. It would be extremely manual/time consuming to import each file individually especially given the frequency of updates.

I've got my fingers crossed that there is a way to automate this process. Help!

Thanks for any advice/instructions you can offer!!

Reply With Quote
  #7  
Old May 17th, 2005, 10:36 PM
Dan806 Dan806 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 1 Dan806 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 16 sec
Reputation Power: 0
Here is some code copied from the VBA help that uses Applciation.FileSearch that may be usefu.

Sub BatchImport()

With Application.FileSearch
.NewSearch
.LookIn = "C:\MyData"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks

If .Execute() > 0 Then 'Files found
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count
'Transferspreadsheet
Next i
Else
MsgBox "There were no files found."
End If

End With 'End Filesearch

End Sub

Dan

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Can I import all excel files in a directory to Access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT