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

Create worksheet name conflict result in error with no message #359

Closed
samzhang111 opened this issue Feb 26, 2016 · 3 comments
Closed

Create worksheet name conflict result in error with no message #359

samzhang111 opened this issue Feb 26, 2016 · 3 comments

Comments

@samzhang111
Copy link

I propose wrapping this in a custom exception. WorksheetExistsException?

@seandmatthews
Copy link

It's a pretty easy fix. I mean, the error is exactly what it says on the tin. Someone wrote an HTTPError class and then tries to show you the message on that class, but didn't actually get around to creating a message attribute.

I added a quick fix for this in my PR. #390

It just raises a RequestError using the error string that you get back from the Google API, which tend to be pretty reliable and informative.

I'm not sure when or if my PR will get merged, but if it doesn't it should be a pretty easy thing to fix regardless.

@burnash burnash added this to the 1.0.0 milestone Dec 12, 2016
@burnash burnash removed this from the 1.0.0 milestone Mar 3, 2017
@lavigne958 lavigne958 changed the title Adding worksheet that already exists returns AttributeError: 'HTTPError' object has no attribute 'message' Create worksheet name conflict result in error with no message May 15, 2021
@lavigne958
Copy link
Collaborator

This is not the case anymore. Did a test:

  • create a spreadSheet with new name "Test1" => ✔️
  • run the script again and create a spreadSheet with the same name => ✔️

this is due to the following rule in Google API: "he name of the file. This is not necessarily unique within a folder." here

This means you can create multiple files with the same name in a single folder, they will all have different IDs.

What could be useful here is an option like: "fail if already exists", before the actual HTTP call, gspread could check for a file existence of the same name (and returns its id in this case, or open the actual file, to be thought through).

@lavigne958
Copy link
Collaborator

Using new GoogleAPI this is not relevant anymore.

Closing this issue.

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

No branches or pull requests

4 participants