Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何仅在单元格的一部分中获取/创建超链接?_Java_Google Apps Script_Google Sheets_Google Api_Google Sheets Api - Fatal编程技术网

Java 如何仅在单元格的一部分中获取/创建超链接?

Java 如何仅在单元格的一部分中获取/创建超链接?,java,google-apps-script,google-sheets,google-api,google-sheets-api,Java,Google Apps Script,Google Sheets,Google Api,Google Sheets Api,我正试图找出如何在谷歌电子表格单元格的一部分中获取或创建超链接。例如,如果我的单元格是用markdown编写的,它将如下所示: Device ID, found on [the inventory website](https://www.example.com/) 我尝试了方法CellFormat#getHyperlinkDisplayType()和CellData#getHyperlink(),两者都返回null。我检查了调试器中的所有单元格数据,但在任何地方都没有看到URL。这使我有理由

我正试图找出如何在谷歌电子表格单元格的一部分中获取或创建超链接。例如,如果我的单元格是用markdown编写的,它将如下所示:

Device ID, found on [the inventory website](https://www.example.com/)
我尝试了方法
CellFormat#getHyperlinkDisplayType()
CellData#getHyperlink()
,两者都返回null。我检查了调试器中的所有单元格数据,但在任何地方都没有看到URL。这使我有理由相信我需要在
设置字段
方法中包含另一个字段:

Sheets sheets = auth.getService();
Get request = sheets.spreadsheets().get(id).setFields(
"sheets.properties,sheets.data.rowData.values(effectiveValue,effectiveFormat.backgroundColor)");
Spreadsheet response = request.execute();
我不确定哪个字段会包含超链接,也找不到可供我使用的字段列表。我还希望能够创建一个超链接,它只覆盖单元格中的部分文本


这可能吗?

我相信你的目标如下

  • 您希望使用Sheets API在单元格中的部分文本中检索或创建超链接

  • 作为示例情况,您希望检索
    https://www.example.com/
    从电子表格的以下情况的单元格“B1”中。此外,您还希望创建类似单元格“B1”的情况

    一行 A列 B栏 1. 设备ID 发现
    我相信你的目标如下

    • 您希望使用Sheets API在单元格中的部分文本中检索或创建超链接

    • 作为示例情况,您希望检索
      https://www.example.com/
      从电子表格的以下情况的单元格“B1”中。此外,您还希望创建类似单元格“B1”的情况

      一行 A列 B栏 1. 设备ID 发现