Results 1 to 7 of 7
  1. #1
    HansBades is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    85

    Copy and Paste from Excel not working

    I am trying to copy three columns of data from excel into an access table. The table has a primary key id field and then it has three fields which I am trying to populate from excel. When I try to copy and paste or append them, only the second column pastes into the access table. Any ideas of how I can fix this? Thanks.

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    not without seeing some example data and what your table looks like. Excel is not strongly datatyped whereas databases are. So if Access cannot identify the excel data as the correct datatype, it will be ignored. Or it may be you need to highlight the 3 columns in the table before pasting.

    Either way, not a good way on which to base an import process if this is going to be ongoing

  3. #3
    HansBades is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    85
    The data import comes from an excel spreadsheet. Currently this is the only way the data is available. If cutting and pasting is not a good way, what other way would you suggest? Perhaps a vba program to extract from excel and insert into the access table? Thanks for your help.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,944
    Link to the Excel sheet ?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    depends on the requirements of the app but one way is to use transferspreadsheet to append the data to your table - see this link https://docs.microsoft.com/en-us/off...ferspreadsheet

    another, create a linked table either through the linked table manager or in code using transferspreadsheet but to link to the excel file rather than importing - perhaps then you don't need to import it? Either way you can then use an append query to append data from your linked table to your destination table.

    Another is to just use a query. Basis would be this which is the equivalent of a linked table

    Code:
    SELECT XL.*
    FROM (SELECT * FROM [sheet1$] AS xlData IN 'C:\path\filename.XLSX'[Excel 12.0;HDR=yes;IMEX=0;ACCDB=Yes])  AS XL;
    to specify a range you might use this

    [sheet1$]E:G

    for data in columns E,F and G


    or

    [sheet1$]E25:X

    which will import columns E to X starting at row 25

    you get the idea

  6. #6
    HansBades is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    85
    Many thanks to all for great suggestions!

  7. #7
    RE_ is offline Novice
    Windows 10 Office 365
    Join Date
    Mar 2022
    Posts
    23
    I had the same problem in the past. Try to format the data from excel to TEXT.

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

Similar Threads

  1. Replies: 2
    Last Post: 03-14-2019, 11:00 AM
  2. Replies: 4
    Last Post: 06-28-2015, 08:10 PM
  3. Excel object, copy and paste a worksheet
    By crowegreg in forum Programming
    Replies: 2
    Last Post: 05-28-2014, 12:04 PM
  4. How to copy and paste between worksheets in Excel?
    By Ronald Mcdonald in forum Programming
    Replies: 6
    Last Post: 05-26-2012, 10:40 PM
  5. COPY records from SUBFORM and PASTE to EXCEL?
    By taimysho0 in forum Programming
    Replies: 9
    Last Post: 11-28-2011, 02:45 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