Is there any way to create spreadsheet only using the scope https://www.googleapis.com/auth/spreadsheets
in Gspread?
Based on the documentation, seems like that scope itself can handle "create":
Please suggest the example code or web related to this issue
Yes you can cretae a spreadsheet using Google API with just one of the following scopes:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/spreadsheets
Source: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/create
The Google Drive permission scope is only required if you intent to save the file to a specific folder. Otherwise, you can save to root directly with just the https://www.googleapis.com/auth/spreadsheets
scope.
Although it is possible to pass in custom scopes in GSpread:
# Use one of the following, depends on your use case
gspread.oauth(scopes=['https://www.googleapis.com/auth/drive'])
gspread.service_account(scopes=['https://www.googleapis.com/auth/drive'])
Source: https://docs.gspread.org/en/latest/api/top-level.html
However, in the source code: https://github.com/burnash/gspread/blob/50b910f2911c6203e139934bafbbce9fe300e8e1/gspread/client.py#L228
It used the Google Drive's create
API to create the Spreadsheet instead of using Google Sheets API, that's why it will require the https://www.googleapis.com/auth/drive
scope