Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent creation of duplicated names #870

Closed
lavigne958 opened this issue May 16, 2021 · 2 comments
Closed

Prevent creation of duplicated names #870

lavigne958 opened this issue May 16, 2021 · 2 comments

Comments

@lavigne958
Copy link
Collaborator

current behavior

When creating a spreadsheet, Google API does not block when an other Spreadsheet exists with the same name. It will create a second one with the same name.

Possible improvement

Add an option on method create that will first check if a spreadsheet with the name exists before creating a new one.

This could prevent creating a spreadsheet with a name, loosing it's ID then trying to create it again and create a duplicate of the first one.

errors cases

If the spreadsheet already exists 2 possibles solutions to warn the user about it:

  • raise an exception (SpreadsheetExists) and do not create a new one. This will maintain a unique path for each action, create only create a new non existing file and open only opens existing files.
  • open and return the spreadsheet with no error.
    This will change the behavior of gspread but can be handy for a lot of users.

@aiguofer @burnash
What do you think is best?

@lavigne958
Copy link
Collaborator Author

Relates to #359

@lavigne958
Copy link
Collaborator Author

Won't do, we should not prevent users from creating spreadsheets if the API allows it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant