-
Notifications
You must be signed in to change notification settings - Fork 942
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
support public published spreadsheets #345
support public published spreadsheets #345
Conversation
Thanks a lot! A lot! |
@paulfitz Thank you very much for the PR and sorry for the delay in reviewing it. This is a great feature. The test fails for my public spreadsheet. It looks like the request in ======================================================================
ERROR: test_properties (tests.test.PublicSpreadsheetTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "gspread/tests/test.py", line 176, in setUp
self.spreadsheet = self.gc.open_by_key(key)
File "gspread/gspread/client.py", line 120, in open_by_key
raise SpreadsheetNotFound
SpreadsheetNotFound:
-------------------- >> begin captured logging << --------------------
requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): spreadsheets.google.com
requests.packages.urllib3.connectionpool: DEBUG: "GET /feeds/worksheets/1NjijBhs1syNImXr4ihnrU2xGCLFvSkN-6-ZSTe_-k6Y/public/full HTTP/1.1" 302 None
requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): www.google.com
requests.packages.urllib3.connectionpool: DEBUG: "GET /accounts/ServiceLogin?service=wise&passive=1209600&continue=https://spreadsheets.google.com/feeds/worksheets/1NjijBhs1syNImXr4ihnrU2xGCLFvSkN-6-ZSTe_-k6Y/public/full&followup=https://spreadsheets.google.com/feeds/worksheets/1NjijBhs1syNImXr4ihnrU2xGCLFvSkN-6-ZSTe_-k6Y/public/full<mpl=sheets HTTP/1.1" 302 542
requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): accounts.google.com
requests.packages.urllib3.connectionpool: DEBUG: "GET /ServiceLogin?service=wise&passive=1209600&continue=https%3A%2F%2Fspreadsheets.google.com%2Ffeeds%2Fworksheets%2F1NjijBhs1syNImXr4ihnrU2xGCLFvSkN-6-ZSTe_-k6Y%2Fpublic%2Ffull&followup=https%3A%2F%2Fspreadsheets.google.com%2Ffeeds%2Fworksheets%2F1NjijBhs1syNImXr4ihnrU2xGCLFvSkN-6-ZSTe_-k6Y%2Fpublic%2Ffull<mpl=sheets HTTP/1.1" 200 None
--------------------- >> end captured logging << --------------------- |
Any update on this? I am really interested in it. |
You can already do this with pandas
…On Fri, Feb 24, 2017, 5:19 PM Marcel ***@***.***> wrote:
Any update on this? I am really interested in it.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#345 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACjB_r08AQt6e-Zw45lWq-6867pCIBk-ks5rf1dUgaJpZM4HGNpQ>
.
|
@richiverse link? or what do you mean? :) |
8a8ff05
to
1418f1f
Compare
I've rebased this to bring it up to date. @burnash I can replicate what you see using a spreadsheet that is public but not published (in the sense of To be concrete, https://docs.google.com/spreadsheets/d/1F0ow6Rx7oGGy26cQO3nmI-NhwDL41CxoNz1lkaA4hQ8/edit?usp=sharing (public but unpublished) fails tests for me but https://docs.google.com/spreadsheets/d/16i5mfs194m44guNIBUylgZrvNslQlkp7F9JNbQar7E4/edit?usp=sharing (public and published) passes tests for me. |
Took another quick check to see if it is possible, when logged in, to access a public non-published spreadsheet programmatically. But I can't get past a |
@paulfitz Thanks for the clarification. I actually didn't know that there is this difference. Let me try again. |
This allows use of gspread without an authorization step when accessing public spreadsheets that have been "published to the web." It adds a new gspread.public() alternative for creating a client. The client won't be able to access private spreadsheets.
1418f1f
to
314d555
Compare
The branch had become a little stale so I've rebased again. I also added a concrete example of a public, published sheet in
Neither of these steps alone is sufficient to make the sheet available without login. |
@paulfitz Thank you again for the contribution. I'm really sorry for such a late reply. API v3 has been deprecated for quite a while. I have put all of the time I had for gspread into porting it to API v4. I'm afraid the changes in this PR are not relevant anymore. However, the idea of accessing a public spreadsheet and your instructions on how to make public spreadsheets are still relevant. The API migration guide states that the visibility is no longer required in v4:
Which is true. I followed your instructions on how to publish the spreadsheet and was able to retrieve the data from the public spreadsheet. The difference from v3 is that the client has to be authenticated. I'm closing this pull request. I'll update the docs with the instructions on how to read public spreadsheets. |
Thanks @burnash, makes sense! |
This allows use of gspread without an authorization step when accessing public spreadsheets that have been "published to the web."
It adds a new gspread.public() alternative for creating a client. The client won't be able to access private spreadsheets.
An update to
tests.config
is needed to point to a published spreadsheet, some new unit tests added won't pass without that.There's been some related discussion in #175.