Results 1 to 6 of 6
  1. #1
    faodavid is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2014
    Posts
    17

    Import from excel when data is in different columns - beginner

    Hi
    i want to important data from an excel table but the data is not in the correct column order as my database any ideas what I need to do?

    Thanks


    dave

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If you link to an Excel file you can use a query object to help you append records to your table(s).

    Another approach is to import the excel file using a saved procedure/specification. Since the file is not structured the way you need it, your named spec can import to a Temp Table. A query object can then append records to your permanent/production tables. After the append process is complete, you can delete the records from the temp table, using the temp table the next time you call your named spec.

  3. #3
    faodavid is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2014
    Posts
    17
    Thanks for this - I ran a power query on the excel table, made the changes there then imported the power query table - all seems well so far - can you see any potential problems with me doing it this way?
    Dave
    Quote Originally Posted by ItsMe View Post
    If you link to an Excel file you can use a query object to help you append records to your table(s).

    Another approach is to import the excel file using a saved procedure/specification. Since the file is not structured the way you need it, your named spec can import to a Temp Table. A query object can then append records to your permanent/production tables. After the append process is complete, you can delete the records from the temp table, using the temp table the next time you call your named spec.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I ran a power query on the excel table
    If you mean that you linked to the spreadsheet and used an action query to UPDATE records in your table, this is fine. The thing that you need to be aware of is that linking to an Excel Spreadsheet will cause the Excel file to be Read Only. The best approach, when linking, is to programmatically link to Excel and then break the link after you run your Action query.

    My preference is to use temp tables. I will create a copy of the production Excel file in a temp folder and then run the Import procedure on the DB's own personal copy. I suppose you could use a similar approach when linking if there is a chance of other users accessing the spreadsheet.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Actually, a linked Excel can be edited, just not through Access. I just tested. Access linked to spreadsheet, the linked table is open, went to Excel spreadsheet, edit data, return to Access and as soon as I click anywhere on the table, it refreshed and the edits show.

    I do have a vague recollection that this would not work in Access 2003 and/or 2007. Seem to remember not being able to edit spreadsheet if the Access was open.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I think the distinction I should have made is that when a DB is accessing a linked file it will be available to others in Read Only mode. Been a while since I tested it.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 07-31-2014, 12:53 PM
  2. Import access query data into excel file, using excel vba
    By exceljockey in forum Import/Export Data
    Replies: 3
    Last Post: 11-15-2013, 02:36 PM
  3. Import data from Excel
    By jhawkins49 in forum Import/Export Data
    Replies: 5
    Last Post: 08-23-2011, 02:05 PM
  4. Access multiple columns same name? -- beginner
    By zubair.s.kazi in forum Access
    Replies: 1
    Last Post: 07-01-2011, 12:19 PM
  5. Replies: 0
    Last Post: 04-29-2009, 04:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums