473,781 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Import multiple excel files to MS Access XP

3 New Member
I have around 400 excel files with same format (multiple sheets) and wants to import few sheets from excel to MS Access (XP version) for further processing. any one can advise me how to do it? (I'm very new in using VB). Many Thanks!
Sep 1 '08 #1
7 7239
NeoPa
32,577 Recognized Expert Moderator MVP
With the little information you include in the question, I can only think of telling you about using Import & Link Tables.

Importing can import data from Excel into an Access table. It can create the table as part or the process or it can append the data to an existing table.

If you link to an Excel worksheet then that sheet appears in your database as a table.

If you need more help you will need to make your question clearer.

Welcome to Bytes!
Sep 1 '08 #2
ADezii
8,834 Recognized Expert Expert
If you just want to bring Worksheets into a new Table, the easiest way, without even writing a single line of code, is with the Windows Clipboard. Access is sufficiently intelligent to recognize Excel data pasted into the Clipboard, and Access automatically creates a new Table based on that data when you do a Cut-and-Paste operation. If you do this, it is very helpful to include Field Names in the top Row of the selected data of the Excel Worksheet. Access automatically assigns those Worksheet Column Headings as Field Names in the new Table. A few simple steps and you are on your way:
  1. Open the Excel Worksheet and select the data that you want to use to create the Table in Access. If possible, include Column Headings in the selection that can be used as Field Names.
  2. Choose Edit|Copy, Right Click|Copy, etc...
  3. Switch to Access and, with the Tables portion of the Database Window active, choose Edit|Paste, Right Click|Paste, etc...
  4. Access will ask whether the first Row contains Column Headings, answer appropriately.
  5. Good luck, and let us know how you make out.
Sep 2 '08 #3
ivancycheng
3 New Member
Thanks for all your reply! For more information : I have create a template with 10 sheets to estminate the next year budget. Totally I have around 400 files now and I want to consolidate 1-2 sheets in the template to a access database. Any one can advice me how to import these 400 templates to the access (I think VB is nuch useful in these case but I'm fresh on this). Many Thanks!
Sep 5 '08 #4
NeoPa
32,577 Recognized Expert Moderator MVP
Again, with the information you provide, it's unclear what you are dealing with.

Presumably these "templates" are really just workbook files where you have data.

As there are so many of them I expect you would like the importing to be done within your code, yet you tell us nothing about where these files are stored and under which names. Without this, there is no way to see if this can be done algorithmically .

So, in relative darkness, I can only suggest that you create a loop in your code that goes through each workbook file.
For each file import the data into a previously prepared table (the data should append to any existing data). When the loop processing has completed all your data should be available in this table.
Sep 5 '08 #5
ivancycheng
3 New Member
Thanks for your advise. All files store in same folder but the file name is difference (e.g. aa123, aa234......) they have same sheet name (e.g. rev09, rpk09.....) can anyone provide the VB code to me?
Sep 8 '08 #6
NeoPa
32,577 Recognized Expert Moderator MVP
No. Someone cannot simply provide you with code. That would be against the rules of the site.

All we can do is point you in the right direction. Even this will be difficult as it is still not clear what you need. We have asked for clarification, but it doesn't seem to be much clearer now than before.

You don't provide the folder name. You don't clarify what you mean by template. You don't explain what we can expect as far as filenames or worksheet names are concerned (although you provide a couple of examples for each).

I could not code from this, and I have already pointed you in the right direction.

Please don't ask for more help until you've at least tried to produce something, and then you can explain clearly and precisely what you are having difficulty with.

We are here to help you learn, but generally don't appreciate being treated like a free coding service.
Sep 8 '08 #7
cassiomoreno
1 New Member
Actually VB is very useful, but more than doing a loop is how to do it. Because operations inside access are easy, but operations with windows are a little bit more complicated.


If I were you, I would put on a table the route to the directory where the files are in a column and the names of the files in another.

You may think is too muck work to copy all of them... maybe.
I'll write you a code below where you can get the names of the tables, than you treat them in excel with text extraction process... like the funtions mid, left, right, etc...

so:
1. open notepad
2. write the following code:
c: (or another prompt, depending on which you use)
cd " direction of the container folder"
dir /s > filename.txt

3.This will generate a text file with the name you chose. Open it, then you can copy all of the file's names, paste in excel adn get the names to paste on the access table i told you before.

4. Create a very simple loop in VBA:
a. Create a loop
b. inside the loop, create an importing process
There you have, everything imported.

To put them all together you can create a union query on SQL. Which is very simple and you can find millions of instructions in thousands of languages on google.

If you have a little ability with Access VBA, from creating the the batch file to have it all imported, you can have it all done in less than an hour.

Seems complicated, but it's the most simple I've ever found for a start process, or paliative process.
For a recurrent process, then you have to write the complete code: from reading the directory to adding the imported files throughout the loop...

Hope to have helped.
Apr 13 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3717
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook - and dump everything into a table. The problem is once I have the data imported into a new table, I can't do much with it. If I try to run an Append query and insert data from the new table into an existing table, the query fails - "Error...
2
2538
by: amy | last post by:
Hi, all: i am a new end user of access, now I have many excel files need to import to One table in access (combine all excel files into one table in excel). In excel files, some columns will have both # and text in the same column. The coloumn names in each excel file are mostly same but still a lot of different names(items). I was told to set up import specification, but how? i am not a programer or not access professional, please help...
11
5388
by: MD | last post by:
Hello, I need to import a sheet of 884 different excel-file with same lay- out. The sheet name is 'Totaal' and is the same in all different files. Is there a script (module) in order to: 1. create a table with all the different names of the 884 files 2. create the import queryfor the 884 different files, but also mentioning the file name of the excel-file in a colomn
3
7828
by: theodorej | last post by:
......how do I select multiple Excel files to import into Access? Any insights would be deeply appreciated.
3
3615
by: MarcGA | last post by:
(Excel 2003, Access 2003, XP, novice user here) I can't get Access to accept multiple Excel files to the same table. I can import the spreadsheets to a new table, but I need to import 23 spreadsheets to the same table. I'm not getting a formatting error, just a "file did not import" message. Also, when I do import one-to-one, Access inserts thousands of blank lines before the first line of imported data. How do I keep Access from doing...
8
9656
by: shenkel55 | last post by:
I'm using Access and Excel 2003. Using either the import wizard or code, I have the same problem. This problem only happens with Excel files automatically generated by Corp IT. If I try to do an import and the Excel file isn't open I get the following error: "The wizard is unable to access information in the file "...path info... "Please check that the file exists and is in the correct format." If the files are opened directly in Excel, it...
5
6531
by: hushens10 | last post by:
Access Naive - Help Needed I am using Access 2003 and Excel 2003. My goal is to create a database for a school where each student's testing information can be stored and organized so that it can be pulled. Each teacher currently has their own Excel file, into which they have entered their student's data. However, for the purposes of other departments, they would like a database file where information can be culled and queries can be run (thus...
6
26330
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this one table. My problem is I have two buttons I want to use this code for for the two buttons would put the data in different tables. I have tried copying and changing a few things and nothing will work for me. The code is set up in a module and then I...
2
3006
by: BlackEyedPea | last post by:
Hi I have no coding experience but am using access 2003 on XP in the hope that I can find some code that will.... Search a folder in my network & import any excel spreadsheets it finds within that folder, putting the data into one large access table. All the spreadsheets have the same layout although for some bizarre reason (I didn't archive them you see!!!) they have different file names. I have already found some code which I include...
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10143
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9939
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.