+ Reply to Thread
Results 1 to 4 of 4

Import 5 excel workbooks into 1 access table

  1. #1
    Registered User
    Join Date
    02-09-2011
    Location
    Portland, oregon
    MS-Off Ver
    Excel 2007
    Posts
    16

    Question Import 5 excel workbooks into 1 access table

    Hello again all...

    I have 5 excel workbooks (all identical) that have a hidden worksheet called MTS_datatable. This worksheet has formulas instead of just plain values.

    On a Form Button click in Access I want to iterate through the 5 workbooks and import the entire "MTS_datatable!" sheet values (they have headers) into one Access table called DataTable (this table has all the same fields except it has an ID field where it assigns each imported row a unique ID).

    Importing Columns A:J and only down to the last row that has actual values in it - it is currently importing 100 rows where only 16 have values - because the rest have formulas, so I get 16 data rows in access table and 84 blank rows. I even tried putting in a NEW sheet called datatbl and doing an ON CLOSE event where it would do the following:

    Please Login or Register  to view this content.
    Now I have values only, but it still imports the full 100 rows??

    Currently have the following on button click in form:

    Please Login or Register  to view this content.
    I have great code that looks in "I:\Devprojects\MTS\mts" folder and lists the five excel sheets. Now I just need to figure out the next step, which is a button click that imports the worksheets in the found workbooks into the one master DataTable in access while ignoring all blanks (not really blanks they have Transition Navigation Keys (') in them).

    The attached is an example of what I am importing (see the sheet "datatbl!")

    See this post if you need more background on this sheet http://www.excelforum.com/excel-prog...t-on-save.html

    Thanks!!
    Last edited by pjkeady; 05-31-2011 at 12:55 AM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Import 5 excel workbooks into 1 access table

    Hi,

    Having read through your other thread, I'm not sure why you didn't do the whole project in Access?

    I'm also not sure what you mean by blank rows, do these need excluding or including? If someone deletes a row from the input sheet this would create a blank row in your summary sheet - Do these need excluding or are you preventing this from happening?

    If so, to just get the cells with data in them you could set up a named range as follows and import this:

    Please Login or Register  to view this content.
    If you have blank rows, you would probably need to do some modification first.

    The way I'd look at doing this from access is as below - saves fiddling in Excel and gives you a bit more control, also takes care of the blanks problem!

    Let me know if you want me to talk you through any of this


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-09-2011
    Location
    Portland, oregon
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Import 5 excel workbooks into 1 access table

    Ofcourse, SQL import from Access...that is another way to look at this, now to just iterate through the 5 excel workbooks using my other code and perhaps this will work?? I will get to work and see if this will work with what I have so far. Like putting puzzle pieces together isn't it?

    Thanks.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Import 5 excel workbooks into 1 access table

    Its handy doing it like this because it's easier to write a query to get rid of the pesky blanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1