Import multiple worksheets

I have a service report in Excel format that is divided into 8 separate worksheets, and I would like to be able to import all of them at the same time into a database I'm developing. Until now I have been doing it manually in the File -> Get External Data -> Import, but this is a very laborious process that has an added risk of operator error. I've seen that it's possible to run a macro that would import worksheets, but in writing the macro Access needs to know the filename ahead of time.

With my service report, all of the worksheets are named to correspond to the tables I want to import into, but the filename will not be consistent. Therefore I believe I'll have to do this in VBA. Although I have VBA experience in Excel, I don't know how to do it in Access. Would someone be able to point me in the right direction

Sponsored Links:

Related Topics

Importing data from spreadsheet
I have multiple workbooks and within that there will be multiple worksheets. Number of workbooks and worksheets in that vary but the columns remain same. all put together there will be around 600K - 650K.

now I am looking to build a VBA in Access 2007 to import all the data into one table at one shot so I can write queries and perform the reporting activities.


How do i import multiple excel spreed sheets into Access?
All worksheets in Excel file can have a various number of worksheets, but all data in each worksheet has same headers. I need all data to go into a user selected table that already exists in Access.

What I would like to happen is user run a macro to prompt to select a file from any given file path. After they select the file it should ask them or direct them into choosing what table should data be appended to.

User would then choose/select table and data would start to import. I would like the importing to either be visible or have the user be notifiedwhen import is completed.


Users import from Excel to Access
I'm trying to create a macro that will do the following.

I could use the "Run Command" -> "Import", but I'm trying to automate this process to keep the user interaction down.

2. Import the excel file (2 worksheets) into 2 table in access. The worksheets first row is a header row.
This is easy to do using the "Import" command to bring up the Import Wizard, but since I want to stay away from the wizard, I believe that I should use the "Transfer Spreadsheet" command". The problem I run into here, is that I'm required to put the filename and path into the "File Name" property.

I am not sure how to set this up since I want to user to browse for the file.

Should I use VBA or can I do this with macros? Are there better commands to use or a better method to do this?


Combine multiple tables into 1
I'm asking this on behalf of a friend, so I have not seen the data myself.

She has an Excel workbook, with approx. 60 worksheets. Each worksheet is a different cost center; the columns are the same for each worksheet. She needs to combine them all into one spreadsheet.

My initial thoughts were to import the workbook into Access, and then use a Union Query to combine each worksheet. But then I started thinking that isn't there a limit to how many tables you can Union in a Union Query? If so, she would need, what, about 10 Union queries, to get all of the worksheets combined? Is there any other method that could be used to combine these tables in a more expedient way


Importing Data From Excel
I need to import data from several different worksheets within the same Excel workbook into an Access database. I can't figure out how to import more than one sheet at a time. All the sheets have the column headings. I can import the first sheet, but when I try to import the second sheet Access tells me there is an error. It doesn't tell me what the error is though, so I can't go about trying to fix it. If there is a way to do this, I would like to import all the sheets at once


Importing Data From Excel
I need to import data from several different worksheets within the same Excel workbook into an Access database. I can't figure out how to import more than one sheet at a time. All the sheets have the column headings.

I can import the first sheet, but when I try to import the second sheet Access tells me there is an error. It doesn't tell me what the error is though, so I can't go about trying to fix it.

If there is a way to do this, I would like to import all the sheets at once.


Export Queries to Named Excel Worksheets
I am trying to export multiple queries into existing worksheets within the same spreadsheet, but instead of the export overwriting within the existing worksheets, it is creating additional worksheets with the same name plus a "1" suffix. I could rename the queries to the worksheet names, but would prefer to leave the query naming conventions and just specify the name of the worksheet that I want to export to

I am on Access 2010 and the code is as follows:-

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "12 Monthly Day 6 5R", MyPath & "\Day 6 Delivery.xls", False, "5 Region"

I want to export query "12 Monthly Day 6 5R"
into file "Day 6 Delivery.xls"
and overwrite worksheet "5 Region


DoCmd.TransferSpreadsheet not overwriting worksheet
The database I inherited has a series of queries that output the final results to a format template, overwriting the data on each worksheet that has the same name as the query. I've added two additional worksheets with the appropriate names, but for some reason the new worksheets are not being overwritten like the other ones in the workbook. Instead, the worksheets are being added at the end with the correct names but appended with "1" at the end as if the script recognizes that the worksheets are there but cannot overwrite them for some reason. The section of the relevant code is as follows...


Importing Excel 2007 spreadsheet into Access 2002
I have an Access 2002 database which a number of users use to import worksheets from excel. Most of my users are using excel 2003 but a few have migrated to excel 2007 to move beyond the row limitation. The GUI for my db uses the docmd.transferspreadsheet command to import the excel tables. I get an error when trying to import an excel 2007 table. Any comment on modifing the vba code to allow import of the excel 2007 data.


Import multiple txt files and filename?
I have a question regarding import of multiple Text files.

These files all have different names but will always be found in the same location.

C:\Documents and Settings\computer\Desktop\F FILES

I have little VBA knowledge and am wondering if I can import these files into an existing Access table tbl_Table via a macro?

A number of problems:

1. It does not import directly into the existing table, instead it creates a new table tbl_Table , I'd like to import directly into the existing table without using append or similar.

2. I cannot get it to import ALL files in the folder.

3. I'd like to import the first 7 characters of the filename into a field (KEY).


Import Worksheet From Excel 2010
You can share data between Access 2010 and Excel 2010 in many ways. Excel worksheet consists of cells that are organized into columns and rows, Access recognize them as fields and records. Access 2010 provides an easy way to import Excel worksheets, this post will explain in detail how to import worksheet in Access from Excel 2010.


Assigning variable to worksheets
I keep getting subscript out of range errors when I try to set my excel worksheets. Port is the name of the tab in excel and stPort is the name in my query....


Import excel cells with multiple entries to Access
I am trying to import data from an Excel spreadsheet (exported from a software). In that spreadsheet, some of the cells contain multiple values, separated by a coma (e.g.: value1, value2, value3, ) In order to produce meaningful reports, I need access to understand that those are multiple values.

In the past I used to create lookups for this kind of scenarios. It works fine if I enter the data in Access, but with a lookup, I cannot paste data (even if it is formated exactly the same way).

Any idea of how I can get around this issue? (NB - I will need to regularly import new data from access).


Import Workbook with Multiple Sheets into Database
I have an Excel workbook with multiple sheets (22)! that I would like to import into Access Tables for manipulation. I'd like to load them the same table if possible, so long as Iknow what the name of the sheet the records came from originally.

Is there any systematic way of doing this?


Excel Macro Message
I know this isn't an Access issue. I've posted it on the Excel page, which doesn't seem to get much traffic, so I thought maybe someone here might have an answer: Some time ago I was messing around with macros in a couple of my worksheets. I've since deleted them, but every time I open these worksheets, I get a message box asking me to either enable or disable the macros. I've gone to Tools-Macro-Macros and checked in This Workbook and All Workbooks. There are no macros in either of these worksheets. How do I get rid of this annoying message


Unable to copy Excel worksheets in VBA
Here is the code I am using in Access 2007 to manipulate Excel.
The sheets are renamed, but the workbooks remain hidden, and will not copy. It fails on the Copy After command.
I am using Excel 2007.
Any idea what is wrong?
DoCmd.TransferSpreadsheet acExport, 10, "tbl_A, "C:\A.xlsx, True
DoCmd.TransferSpreadsheet acExport, 10, "tbl_B", "C:\B.xlsx, True

Set MyXl = GetObject("C:\A.xlsx")
Set MyXl1 = GetObject("C:\B.xlsx")

MyXl.Worksheets(1).Name = "A_Sheet"
MyXl1.Worksheets(1).Name = "B_Sheet"

MyXl1.Worksheets("B_Sheet").Copy After:=MyXl.Worksheets("A_Sheet


Export Multiple Queries to xls 97-2003 separte worksheets same workbook
Ive googled and googled and have found bits and pieces of useful info on how to achieve this but struggling to put it all together. I am using Ms access 2010 and have been assigned a task to update an already functioning export that allows users to pick a qry from a listbox. Clicking an export button opens the save as dialogue where users pick 97-2003 and assign a filename and save.

I would like to do the same exact thing but with 2 separate queries into 2 separate worksheets on the same workbook.
Current code accomplishes the single worksheet example.
DoCmd.OutputTo acOutputQuery, strQryName


Import Multiple Excel sheets into a table
We have 26 files we need to import into a table. each time I have been right clicking on the table, import, select excel, select the file, upload, okay.repeat.

Is there any way I can select multiple excel sheets to simplify this process


Simple Access Import & Export Query
I am relatively new to using MS Access and have two very simple queries below.

Using VBA, how do I

1) Import 3 txt files all saved in a specific location with different file names into a specific table I have already created in Access. The data in the text files is pipe delimited.

2) Export data in Access tables into an Excel file and split the tables into different worksheets according to table name in the same workbook.


TransferText / Import
I've been using DoCmd.TransferText to import a prenamed text file, however, would like to giv the user the ability to specify the file to be imported, including the ability to select multiple files to import/ append to table at once.