如何定位谷歌电子表格ID?

时间:2021-11-27 20:27:56

https://developers.google.com/apps-script/guides/rest/api#parameter_and_return_types

https://developers.google.com/apps-script/guides/rest/api parameter_and_return_types

When using the Google Execution Api for Java, the ID of the spreadsheet isn't very easy to understand. Here is the code snippet:

当为Java使用谷歌执行Api时,电子表格的ID不是很容易理解。下面是代码片段:

// Initialize parameters for that function.
String sheetId = "<ENTER_ID_OF_SPREADSHEET_TO_EXAMINE_HERE>";
List<Object> params = new ArrayList<Object>();
params.add(sheetId);

Any Ideas on how to locate this. I run the Sheets api to return the id of a SpreadSheet but it returns a link, and when I use the https://spreadsheets.google.com/feeds/spreadsheets/STRING or just the STRING itself I still get: "code" : 404, "errors" : [ { "domain" : "global", "message" : "Requested entity was not found.", "reason" : "notFound"

关于如何定位的任何想法。我运行Sheets api来返回电子表格的id,但是它返回一个链接,当我使用https://spreadsheets.google.com/feeds/spreadsheets/STRING或者仅仅是字符串本身时,我仍然得到:“code”:404,“errors”:[{“domain”:“global”,“message”:“required entity not found”。“理由”:“notFound”

2 个解决方案

#1


12  

Found this deep inside the Apps Script API reference.

在应用程序脚本API引用中找到这一点。

A spreadsheet ID can be extracted from its URL. For example, the spreadsheet ID in the URL https://docs.google.com/spreadsheets/d/abc1234567/edit#gid=0 is "abc1234567".

可以从其URL中提取电子表格ID。例如,URL https://docs.google.com/spreadsheets/d/abc1234567/edit#gid=0的电子表格ID为“abc1234567”。

#2


5  

https://developers.google.com/sheets/api/guides/concepts

https://developers.google.com/sheets/api/guides/concepts

states that:

州:

Every API method requires a spreadsheetId parameter which is used to identify which spreadsheet is to be accessed or altered. This ID is the value between the "/d/" and the "/edit" in the URL of your spreadsheet. For example, consider the following URL that references a Google Sheets spreadsheet:

每个API方法都需要一个spreadsheetId参数,用于标识要访问或修改的电子表格。此ID是电子表格URL中的“/d/”和“/edit”之间的值。例如,请考虑引用谷歌表格电子表格的以下URL:

https://docs.google.com/spreadsheets/d/1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps/edit#gid=0

The ID of this spreadsheet is 1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps.

这个电子表格的ID是1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps。

So I just pulled up my spreadsheet and looked at the URL to find my ID.

于是我打开电子表格,查看URL以找到我的ID。

Hope this helps!

希望这可以帮助!

#1


12  

Found this deep inside the Apps Script API reference.

在应用程序脚本API引用中找到这一点。

A spreadsheet ID can be extracted from its URL. For example, the spreadsheet ID in the URL https://docs.google.com/spreadsheets/d/abc1234567/edit#gid=0 is "abc1234567".

可以从其URL中提取电子表格ID。例如,URL https://docs.google.com/spreadsheets/d/abc1234567/edit#gid=0的电子表格ID为“abc1234567”。

#2


5  

https://developers.google.com/sheets/api/guides/concepts

https://developers.google.com/sheets/api/guides/concepts

states that:

州:

Every API method requires a spreadsheetId parameter which is used to identify which spreadsheet is to be accessed or altered. This ID is the value between the "/d/" and the "/edit" in the URL of your spreadsheet. For example, consider the following URL that references a Google Sheets spreadsheet:

每个API方法都需要一个spreadsheetId参数,用于标识要访问或修改的电子表格。此ID是电子表格URL中的“/d/”和“/edit”之间的值。例如,请考虑引用谷歌表格电子表格的以下URL:

https://docs.google.com/spreadsheets/d/1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps/edit#gid=0

The ID of this spreadsheet is 1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps.

这个电子表格的ID是1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps。

So I just pulled up my spreadsheet and looked at the URL to find my ID.

于是我打开电子表格,查看URL以找到我的ID。

Hope this helps!

希望这可以帮助!