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

Possible to have an anonymous session with a "public" document #175

Closed
dansteingart opened this issue Oct 11, 2014 · 7 comments
Closed

Possible to have an anonymous session with a "public" document #175

dansteingart opened this issue Oct 11, 2014 · 7 comments

Comments

@dansteingart
Copy link

Is there anyone to instantiate a client without "logging" in, for example if the shared sheet is publicly viewable?

TIA.

@gonis
Copy link

gonis commented Nov 25, 2014

HI,

Since gspread is such an amazing solution to access google spreadsheets, I would like to use it. In my case I need to deal with a publicly available spreadsheet. I did not find the way to do so (not very fluent in python :-( ) In any case, is this possible?

@burnash
Copy link
Owner

burnash commented Nov 25, 2014

I'm afraid at the moment it's not possible (due to Google API restrictions.)

@MikeOrtiz
Copy link

Hi @burnash,

I don't think this is true. Here is a very short example which returns a spreadsheet's worksheet's titles using gdata. Note, that I received the correct output for the 'published_to_the_web' key, but the 'public_on_the_web' key threw an error. See this StackOverflow post for more information.

Using gspread, any attempts to view a public document, even while logged in, threw a SpreadsheetNotFound error. I had to explicitly click the link to add the document to "My Drive" in order to access it via gspread. As evidenced by this gdata example, that should not be necessary.

from gdata.spreadsheet.service import SpreadsheetsService

published_to_the_web = '1P_DNfuhcbbpR0hJ7_zaXLRRcFr3fq-07_Nu3EhSuRTg'
public_on_the_web = '1h3xza_Tw_BAm8DZxoe2lP0PDkFDmUiFmvDeYxAn6SKE'

client = SpreadsheetsService()
feed = client.GetWorksheetsFeed(published_to_the_web, visibility='public', projection='basic')

for sheet in feed.entry:
  print sheet.title.text

@JoselleAstrid
Copy link

I'll vouch for @MikeOrtiz being correct; this should be possible. Here's a bare URL example, in case it helps anyone unfamiliar with gdata.

https://spreadsheets.google.com/feeds/list/<spreadsheet_key>/<worksheet_id>/public/basic

This will include all the cells' data in a worksheet, without needing any authentication, as long as the containing spreadsheet is "published to the web" via File -> Publish to the web.

@msuozzo
Copy link
Collaborator

msuozzo commented Oct 12, 2015

This is dependent on #145

@lavigne958
Copy link
Collaborator

Like for #145 , tested it and it works now. Closing this issue.

@ebw44
Copy link

ebw44 commented Jan 11, 2023

Does anyone have an example of how to create a gspread.client.Client without authentification? Or is there a way to access to create a Spreadsheet without a client?

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

8 participants