Results 1 to 8 of 8
  1. #1
    EddieN1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2011
    Posts
    316

    Import HTML cell from Excel into Access table using TransferSpreadsheet


    I have a process where I use TransferSpreadsheet with acImport to transfer an Excel worksheet into an Access table. One of the columns contains HTML or Rich Text formatted data. When I run the TransferSpreadsheet, it imports that column in Plain Text. I have defined the receiving field as Long Text with a Rich Text format. I am also using acSpreadsheetTypeExcel12Xml as the Spreadsheet Type. What am I missing?

    Is there an alternative to TransferSpreadsheet that will work?

    Thanks, Eddie

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I created table and set field as Long Text and Rich Text. Then I used Import Wizard to append records. The HTML code is recognized.

    Then I tested TransferSpreadsheet. Same result.

    If you want to provide your Excel file, follow instructions at bottom of my post.
    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
    EddieN1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2011
    Posts
    316
    June7, thanks for the prompt reply. Can you show me the parameters you used for the TransferSpreadsheet? Also, the table that I am importing into is a simple, local table in Access.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Imported to local Access table.

    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml, "Condos", "my file path", True
    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.

  5. #5
    EddieN1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2011
    Posts
    316
    Update... my problem might be in the Excel spreadsheet. I'm attaching it to this post. Any help would be appreciated... Eddie
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    There is no HTML code in the sheet. This is just Excel formatting. No idea how Excel codes cell formatting. Just as in Access, normal formatting is not with HTML tags. Rich Text uses HTML tags.

    My test was with text in Excel cell using HTML tags, not Excel formatting. Excel did not display formatting defined by the tags but Access did after import.

    AFAIK, Excel formatting does not export. Can do SaveAs HTML page and then that has HTML tags. Access can import from HTML document but in my test it does not seem to understand the tags. Access recognizes a very limited set of HTML tags.

    I added another column to your sheet and entered HTML tagged text. Import fails to recognize the HTML tags. Weird. Now to see if I can even replicate what I did yesterday with a new workbook.

    Best I can offer is to restore the line breaks, run an UPDATE query that replaces Chr(10) with Chr(13) & Chr(10).

    UPDATE tablename SET fieldname = Replace(fieldname, Chr(10), Chr(13) & Chr(10)) WHERE {some criteria that restricts to new records}.
    Last edited by June7; 04-23-2025 at 03:39 PM.
    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.

  7. #7
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    I read about a trick you can try: change table field to plain text format, do the import, change the field to rtf. OP said that worked BUT they stated that the formatting showed in a form. They didn't say it did so in the table as well. To test that fully, you may need to whip up a form with a textbox formatted as they did (plain text) then alter both the table field and the form control. If it works, it would be a start. Then you'd have to figure out what you would be willing to do to accommodate. One way might be to open the form in design view, alter the control then switch to form view but don't save the form design. I'd want to open it hidden, but I don't know if it can be hidden in design view as I've never tried.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    I'm not sure I understood all of that but in answer to the last sentence, forms can be hidden in design view
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

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

Similar Threads

  1. Replies: 7
    Last Post: 05-13-2023, 08:57 AM
  2. Import Excel data cell by cell into an Access table.
    By russmann2000 in forum Import/Export Data
    Replies: 3
    Last Post: 03-21-2018, 07:18 PM
  3. Replies: 12
    Last Post: 10-08-2014, 02:35 PM
  4. Replies: 1
    Last Post: 07-12-2013, 01:48 PM
  5. Can we post Access cell data to Excel cell properties?
    By Zethro in forum Import/Export Data
    Replies: 1
    Last Post: 12-13-2005, 08:42 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