Can you customize / change the spreadsheet ID of a Google Sheet?

自闭症网瘾萝莉.ら 提交于 2021-01-29 05:25:37

问题


Can you customize / change the spreadsheet ID of a Google Sheet (ie. the ID string that shows up in the gsheet's URL)?

I ask this because when looking at the docs for the gsheet api's create() method and looking at the expected request body template, I see that one of the fields available is the spreadsheetId. Does this mean that I can create() a spreadsheet with a specific spreadsheetId?

I find the docs for the API request bodies to be unclear about what certain fields are and when they are optional.


回答1:


Can you customize / change the spreadsheet ID of a Google Sheet

Answer:

Unfortunately, no this isn't possible.

More Information:

While the spreadsheets.create method does imply that you can select a custom spreadsheet ID when creating a new Spreadsheet, you can see this on the documentation page for the spreadsheet REST Resource (emphasis my own):

Fields:

spreadsheetId string

The ID of the spreadsheet. This field is read-only.

As the spreadsheetId field is read-only, if one provides an ID to the API on creation, then the field will be ignored and an ID will be generated all the same.

I know this is generally bad news, but I hope this is helpful to you!

References:

  • Method: spreadsheets.create | Sheets API | Google Developers
  • REST Resource: spreadsheets | Sheets API | Google Developers


来源:https://stackoverflow.com/questions/63243721/can-you-customize-change-the-spreadsheet-id-of-a-google-sheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!