Forum Discussion

NotSoSmart's avatar
NotSoSmart
Copper Contributor
Jan 31, 2025

Imbed File as text

Hi, 

 

I would like to know if there is a possibility to imbed a file into Excel in text like URL link but instead link it to the path the text itself contains the file 

I know the object option but it looks ugly and its to big to stay pretty 

 

like an Attach file to cell text :)

 

 

2 Replies

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor

    In Excel, while you cannot embed the entire file as text directly into a cell like a URL, you can achieve a clean and functional result with some workarounds:

    Option 1: Hyperlink to a File (Clean Look)

    Instead of embedding the file, you can create a hyperlink that points to the file's path.

    1. Select the cell where you want the link.
    2. Press Ctrl + K or right-click and choose Link.
    3. In the "Insert Hyperlink" dialog:
      • Choose Existing File or Web Page.
      • Navigate to the file, or paste the file path (e.g., C:\Users\YourName\Documents\File.pdf).
    4. Enter custom text like "View Report" instead of the full file path.

    This keeps the cell neat, like:

     [View Report]

    Option 2: Embedding File Contents as Text (Advanced)

    If you literally want the file’s contents as text inside the cell:

    1. Open the file (e.g., a .txt or .csv).
    2. Copy the content.
    3. Paste it into the Excel cell directly (for small files).
      • Use Alt + Enter for line breaks within the cell.

    For large files, this isn't ideal due to Excel’s cell character limits (~32,767 characters per cell).

    Option 3: VBA Macro for Embedded Files (Invisible Attachments)

    If you want to attach the file invisibly and trigger it via text:

    1. Press Alt + F11 to open the VBA editor.
    2. Insert a new module (Insert > Module).
    3. Paste this code:

    Vba code is untested, backup your file first.

    Sub OpenAttachedFile()
        Dim filePath As String
        filePath = "C:\Path\To\Your\File.pdf"
        ThisWorkbook.FollowHyperlink Address:=filePath
    End Sub
    1. Go back to Excel.
    2. Right-click the cell → Assign Macro → select OpenAttachedFile.
    3. Format the cell to look like a link (blue text, underline).

    Now clicking the text triggers the file without showing an ugly object.

    The text was created with the help of AI.

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

     

    Was the answer useful? Mark as best response and like it!

    This will help all forum participants.

  • You can use a HYPERLINK function to do this. 

    =HYPERLINK("C:\Data Science Things\knows.txt","My Studies"). The last argument is optional and that gives your link a very friendly name. Unless i do not understand your question.

Resources