Google Spreadsheets的第一张工作表的ID是否始终为0? [英] Are Google Spreadsheets' first sheets always given an ID of 0?

查看:72
本文介绍了Google Spreadsheets的第一张工作表的ID是否始终为0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Spreadsheets API,并且对于默认的第一张工作表在创建任何新工作表时是否始终ID为0感到好奇.我试图对此进行研究,但是找不到与此有关的任何文档.

I'm using the Google Spreadsheets API and I'm curious as to whether or not the default first sheet, at the time of creating any new sheet, always has an ID of 0. I tried to research about this, but could not find any documentation regarding this.

我应该假设它始终为0,还是每次为了安全起见都应该得到它,以防万一他们将其更改?

Should I assume it will always be 0, or should I get it every time just to be on the safe side, in case they change it?

推荐答案

此答案如何?

在不使用 sheetId 参数的情况下创建新的电子表格时,作为第一个索引存在的工作表的工作表ID为 0 ( gid= 0 )作为默认值.在当前阶段,这是规范.例如,当以下请求正文用于创建新的电子表格时,将创建具有"Sheet1"的工作表的新电子表格.并且"Sheet1"的工作表ID为 0 .

When new Spreadsheet is created without the parameter for sheetId, the sheet, which is existing as the 1st index, has the sheet id of 0 (gid=0) as the default value. In the current stage, this is the specification. For example, when the following request body is used to create new Spreadsheet, new Spreadsheet which has a sheet of "Sheet1" is created. And the sheet ID of "Sheet1" is 0.

{
 "properties": {
  "title": "SampleSpreadsheet"
 }
}

端点:

POST https://sheets.googleapis.com/v4/spreadsheets

情况2:

当使用 sheetId 的参数创建新的电子表格时,可以使用参数指定工作表ID.例如,当以下请求正文用于创建新的电子表格时,将创建具有"Sheet1"的工作表的新电子表格.并且"Sheet1"的工作表ID为 123 .

Situation 2:

When new Spreadsheet is created with the parameter for sheetId, the sheet ID can be given using the parameters. For example, when the following request body is used to create new Spreadsheet, new Spreadsheet which has a sheet of "Sheet1" is created. And the sheet ID of "Sheet1" is 123.

{
 "sheets": [
  {
   "properties": {
    "sheetId": 123
   }
  }
 ],
 "properties": {
  "title": "SampleSpreadsheet"
 }
}

端点:

POST https://sheets.googleapis.com/v4/spreadsheets

结果:

我应该假定它始终为0,还是每次为了安全起见都应该得到它,以防万一他们将其更改?

Should I assume it will always be 0, or should I get it every time just to be on the safe side, in case they change it?

在上述情况下,上述问题的答案如下.

From above situations, the answer for your above question is as follows.

  • 在不为每个工作表使用 sheetId 属性的情况下创建新的电子表格时,第一个工作表的工作表ID为 0 .
  • 当使用每张纸的 sheetId 属性创建新的电子表格时,第一张纸还可以具有除 0 以外的表ID.
  • When new Spreadsheet is created without using the property of sheetId for each sheet, the 1st sheet has the sheet ID of 0.
  • When new Spreadsheet is created with using the property of sheetId for each sheet, the 1st sheet can have also the sheet ID except for 0.

如果我误解了你的问题,而这不是你想要的方向,我深表歉意.

If I misunderstood your question and this was not the direction you want, I apologize.

这篇关于Google Spreadsheets的第一张工作表的ID是否始终为0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆