How to Convert Word Table to CSV Without Losing Embedded Hyperlinks
🔍 WiseChecker

How to Convert Word Table to CSV Without Losing Embedded Hyperlinks

When you export a table from Word to CSV, embedded hyperlinks inside table cells often disappear. The CSV format stores plain text only, so Word strips the URL when you use Save As or copy and paste. This article explains how to extract both the display text and the underlying URL from each cell using a VBA macro and a temporary Excel step. You will learn a repeatable method that preserves every link in a structured CSV output.

Key Takeaways: Convert Word Table to CSV With Hyperlinks Intact

  • Alt+F11 (VBA Editor) > Insert Module > Paste macro: Extracts the URL and display text from every hyperlink in a Word table cell and writes both values into the cell separated by a comma.
  • Copy table to Excel > Save As CSV (UTF-8): Converts the modified Word table to CSV without stripping the URL because Excel preserves the comma-separated values you created in Word.
  • Find and Replace in Word before running macro: Replaces any existing commas in table cells with a placeholder character so the CSV columns stay aligned after export.

ADVERTISEMENT

Why Word Strips Hyperlinks During a Direct CSV Export

CSV is a plain-text format. It stores raw characters with no support for rich objects like hyperlinks, images, or merged cells. When you use File > Save As and pick CSV, Word converts the document to plain text. Every hyperlink is replaced by its display text. The underlying URL is lost.

The same problem occurs if you copy a Word table and paste it into a plain-text editor such as Notepad. Only the visible text survives. To keep the URL, you must write the hyperlink address directly into the cell as text before the export. A VBA macro can do this automatically for every link in the table.

What the Macro Does

The macro scans each cell in the selected Word table. For every cell that contains a hyperlink, it appends the URL to the cell content in a format that CSV understands. For example, a cell that displays “Click here” linked to https://example.com becomes "Click here",https://example.com. The comma acts as the column delimiter in the CSV file.

Steps to Export a Word Table to CSV While Keeping Hyperlinks

  1. Replace existing commas in table cells
    Open the Word document. Press Ctrl+H to open Find and Replace. In the Find what field type a comma. In the Replace with field type a unique placeholder such as [COMMA]. Click Replace All. This prevents commas inside cells from breaking the CSV column structure later.
  2. Open the VBA editor
    Press Alt+F11 to open the Visual Basic for Applications editor. In the menu bar, click Insert and then Module. A blank code window appears.
  3. Paste the hyperlink extraction macro
    Copy the following code and paste it into the module window:

    Sub ExportHyperlinksToCSV()
    Dim tbl As Table
    Dim cel As Cell
    Dim hLink As Hyperlink
    Dim cellText As String
    Dim linkCount As Integer

    Set tbl = Selection.Tables(1)
    For Each cel In tbl.Range.Cells
      linkCount = cel.Range.Hyperlinks.Count
      If linkCount > 0 Then
        Set hLink = cel.Range.Hyperlinks(1)
        cellText = Replace(cel.Range.Text, Chr(13), "")
        cellText = Replace(cellText, Chr(7), "")
        cel.Range.Text = cellText & "," & hLink.Address
      End If
    Next cel
    End Sub

    The macro works only on the first table in the current selection. If you have multiple tables, run the macro once per table.

  4. Run the macro
    Place the cursor inside the table you want to export. Press Alt+F8 to open the Macros dialog. Select ExportHyperlinksToCSV and click Run. Each cell that contained a hyperlink now shows the original text, a comma, and the URL.
  5. Copy the table to Excel
    Select the entire Word table. Press Ctrl+C to copy. Open Excel and click cell A1 on a blank worksheet. Press Ctrl+V to paste. The table appears with the hyperlink columns intact as text.
  6. Save the Excel file as CSV
    In Excel, click File > Save As. Choose CSV UTF-8 (Comma delimited) from the file type list. Name the file and click Save. Excel warns that some features may be lost. Click Yes to confirm. The CSV file now contains the hyperlink URLs as plain text in the same columns as the original cell text.
  7. Restore original commas in Word
    Return to the Word document. Press Ctrl+H. In the Find what field type [COMMA]. In the Replace with field type a comma. Click Replace All to restore the original content.

ADVERTISEMENT

Common Problems When Converting Word Tables to CSV

The macro does nothing when I run it

The cursor must be inside a table when you run the macro. If the selection is outside a table, the macro stops because the Selection.Tables collection is empty. Click inside any cell of the table before pressing Alt+F8.

CSV columns are misaligned after the export

This happens when a cell contains a comma that was not replaced before the macro ran. The extra comma shifts the remaining columns to the right. Repeat step 1 of the procedure and make sure all original commas are replaced with the placeholder before you run the macro.

Hyperlinks with spaces or special characters break the CSV

A URL that contains a comma or a double quote will break the CSV structure. Before running the macro, manually check cells that contain complex URLs. Replace any comma in the URL with %2C and any double quote with %22. The macro does not encode these characters automatically.

Multiple hyperlinks in one cell are lost

The macro extracts only the first hyperlink in each cell. If a cell contains more than one link, only the first URL is written. To export multiple links, split them into separate cells before running the macro or modify the VBA code to concatenate all URLs with a semicolon.

Word CSV Export Methods Compared

Item Save As CSV directly in Word VBA macro plus Excel export
Hyperlink preservation Lost — only display text remains Preserved — URL added as text in the cell
Time required Less than 1 minute 5 to 10 minutes for setup plus per-table execution
Technical skill needed None Basic familiarity with VBA macro execution
Comma handling Automatic — Word quotes cells with commas Manual — you must replace commas before the macro runs
Multiple hyperlinks per cell Not supported Only the first link is extracted

You can now convert any Word table to CSV and keep every hyperlink URL as readable text. Run the macro before each export and restore the commas afterward. For tables with complex formatting or multiple links per cell, consider splitting the data into separate rows before running the macro. The VBA approach gives you full control over the output format without relying on Word’s limited CSV filter.

ADVERTISEMENT