Results 1 to 4 of 4
  1. #1
    Dave_D's Avatar
    Dave_D is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    67

    Importing Specific Cells


    I have a spreadsheet where the data resides in specific cells which needs to be imported into a newly created table. The spreadsheet is static, so I know specifically where each cells data resides. The spreadsheet has no specific heading for table columns. What I need to know, can I import specifically say "E3" into tablename.field1, then import say "G3" into tablename.field2. After row 3 in my spreadsheet, the data resides in ranges. Is this do able? I'm using the TransferSpreadsheet command.

    Thank You!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Not with TransferSpreadsheet method.

    This requires opening and manipulating the spreadsheet as an object in VBA. See if this helps http://www.accessmvp.com/KDSnell/EXC...m#WriteFileRst
    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.

  3. #3
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I have to disagree with June7, you can specify a range for importing data with transferspreadsheet - but you can't use a range for exporting data.

    I can only speculate what you are trying to do but you would need to use multiple transferspreadsheets and perhaps use code to store the E3 and G3 values in temporary tables for subsequent appending or updating to the 'proper' table.

    One of the tricks I've used in the past is to use transferspreadsheet to link to an excel workbook, then providing you can define in sql where your E3 and G3 values are then you can use a query with subqueries or domain functions to pick up these values

    So say C3 says Date and D3 has a date value, F3 says customer and G3 has the customer name. Your data headers are on row 4 and data starts on row 5 and the first column of data is numeric

    You would link without column headings so these will default to field1, field2, field3 etc

    A basic select query (which you can then change to an update or append) would be

    Code:
    SELECT DLookup("Field4","xlsTable","Field3='Date'") as InvDate, DLookup("Field7","xlsTable","Field6='Customer'") As CustomerName, Field1, Field2, Field3....
    FROM xlsTable
    WHERE isnumeric(Field1)=true
    However, I also agree with June7 that manipulating a spreadsheet as an object is a good way to go

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I don't think TransferSpreadsheet would work with discontinuous range, but could be wrong about that.

    And if the spreadsheet structure is simple enough, linking is definitely an option.
    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.

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

Similar Threads

  1. Using cells function while importing data from excel
    By mahmud1180 in forum Programming
    Replies: 5
    Last Post: 10-07-2014, 12:17 PM
  2. Blank cells are Importing
    By Sumanth.Ganjam in forum Access
    Replies: 3
    Last Post: 01-08-2014, 08:04 PM
  3. exporting access report to specific excel cells
    By grgold14 in forum Import/Export Data
    Replies: 1
    Last Post: 02-07-2012, 04:38 PM
  4. Import Specific Cells from Excel to Access
    By Evocube in forum Import/Export Data
    Replies: 2
    Last Post: 01-12-2012, 10:35 AM
  5. Replies: 6
    Last Post: 11-05-2011, 09:01 AM

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