XLSX

超链接

外部链接和内部工作表跳转

外部链接

为单元格添加可点击的超链接,指向网页地址:

{
  "worksheets": [
    {
      "name": "链接",
      "rows": [
        { "cells": [{ "value": "搜索引擎" }, { "value": "代码" }] },
        { "cells": [{ "value": "Google" }, { "value": "GitHub" }] }
      ],
      "hyperlinks": [
        {
          "cell": "A2",
          "target": { "type": "external", "url": "https://www.google.com" },
          "tooltip": "打开 Google"
        },
        {
          "cell": "B2",
          "target": { "type": "external", "url": "https://github.com" },
          "display": "GitHub 仓库"
        }
      ]
    }
  ]
}

内部链接

跳转到同一工作簿中的其他工作表:

{
  "worksheets": [
    {
      "name": "汇总",
      "rows": [{ "cells": [{ "value": "跳转到数据表" }] }],
      "hyperlinks": [
        {
          "cell": "A1",
          "target": { "type": "internal", "location": "数据!A1" },
          "tooltip": "跳转到数据表"
        }
      ]
    },
    {
      "name": "数据",
      "rows": [
        { "cells": [{ "value": "名称" }, { "value": "数值" }] },
        { "cells": [{ "value": "项目 A" }, { "value": 100 }] }
      ]
    }
  ]
}

超链接选项参考

选项类型说明
cellstring单元格引用,如 "A2"
targetobject链接目标
tooltipstring鼠标悬停提示
displaystring显示文本(覆盖单元格值)

target 选项

属性类型说明
typestring"external""internal"
urlstring外部 URL(type 为 external 时)
locationstring内部位置,如 "Sheet2!A1"(type 为 internal 时)
Copyright © 2026