Can I read a google spreadsheet which is open to people, but doesn't have a share option? There's a discussion here, but it's I need to have an authorization to click the share option.
Even copying by URL to my own Google spreadsheet may serve the purpose.
Update:
The idea was once I create a Google API, I should be able to create a .json file with a client email. In the share option, I'm supposed to provide the client email of .json file. You may see: Accessing Google Spreadsheet Data using Python.
This is the spreadsheet page where I'm not finding any Share option: https://docs.google.com/spreadsheets/d/e/2PACX-1vSc_2y5N0I67wDU38DjDh35IZSIS30rQf7_NYZhtYYGU1jJYT6_kDx4YpF-qw0LSlGsBYP8pqM_a1Pd/pubhtml#
Issue:
Publishing the contents of a spreadsheet to the web is not the same as making a spreadsheet public.
The URL you shared refers to spreadsheet contents that were published to the web following these steps. This published website is not the same as the original file where the data comes from, and so it doesn't have most of its functionalities, like a Share button (it doesn't make sense to have a Share button anyway, since this URL is already public).
Solution:
If you want to access the spreadsheet data using a Service Account, you would have to do one of the following (better to use method 1 if you have access to the spreadsheet):
Share the spreadsheet itself (not the published contents) with the Service Account, as explained in the link you referenced.
Use your application to fetch the website contents from the provided URL.
Reference:
Make Google Docs, Sheets, Slides & Forms public
Related
I'm trying to make a function for creating Excel file and upload the excel file to Google Sheets (Google Drive maybe) via API (that's possible I think). Then, the function will publish Google Sheets to Web (like as Publish to Web function in Google Sheets web UI) in order to embed the Google Sheets in my website for Preview.
I could not figure out the API endpoint to do Publish To Web via Python.
There is the only Stackoverflow link I found out that someone did it via JS code (Google Sheets API: How to "publish to web" for embeddable sheet?), but it requires Authentication at the client side. For my case, I want to implement the function in Backend (server) with an Authorization Token (hard-code or managed by backend)
Answer:
Unfortunately there is not API endpoint for Google Drive nor Google Sheets which have the same functionality as the Publish to the web menu item in the Google Sheets UI.
More Information & Feature Request:
As it is possible to use the result of the Publish to the web menu item to embed a Sheet into a web page or Google Sites, it could be a useful API method for either Sheets or even Drive.
You can however let Google know that this is a feature that is important for the Sheets API and that you would like to request they implement it. Google's Issue Tracker[1] is a place for developers to report issues and make feature requests for their development services.
The page to file a Feature Request for the Google Sheets API can be found here[2].
References:
Google's Issue Tracker
File a Google Sheets API Feature Request
Instead of creating an excel sheet, try uploading directly to google sheets using gspread.
If you have an excel sheet you want to go through, try reading the cell in excel then writing that cell in google sheets
(Not my links, but should be a good reference to get started)
https://gspread.readthedocs.io/en/latest/
https://pypi.org/project/gspread/
https://www.youtube.com/watch?v=cnPlKLEGR7E
So with the google sheets api, I can use a credentials json file to edit a google sheet. I don't have to login again and again. Is it possible to do this same thing with the google drive api? I am making a Python webapp, and it is very inefficient to need to log into a google account every time I want to upload a file. I plan on only uploading files to one drive, and not multiple accounts. I have looked on stack overflow a couple times, and can only find documentation on how to login with a user account and this requires I login every time.
Best wishes,
Jake
You can do the same thing as in Sheets, follow the official Python Quickstart from the docs for instructions on how to do it.
I have a working website made using django. I have a private GitHub repository, within it I have excel files which I want to read using pandas read_excel and use on the website. The reason I have made the repository private is because the data is company specific.
1) How do I read an excel file using pandas from a private GitHub repository? Do I need to set up personal access token?
2) After a user logs in to my website, is there then a way to require a further password when they navigate to try and view their company specific dataframe? For example, "User A" will only have access to "Dataframe A", and "User B" will only have access to "Data frame B".
On my local system, the following code works to be able to read the dataframe:
file_path = 'C:/Users/james/Desktop/projects/path/to/excel/file
df = pd.read_excel(file_path)
For my live website, my code which produces the problem is:
URL_path = 'https://github.com/path/to/excel/file/in/private/repository
df = pd.read_excel(URL_path)
I am able to read the excel files on my local computer, but when I try to read in from my private github, I get the following error, even though I know I am using the correct url:
urllib.error.HTTPError: HTTP Error 404: Not Found
I verified this by signing out of my github account, and trying to access the github url with my excel in it, it takes me to a 404 not found page since I am not logged in. When I login to my github account, the same URL takes me to the correct page.
You should need to use a PAO (person access token) from github if the repo is set to private.
You would then need to gather the raw url link to the data and make sure to decode it properly prior to using pandas to read it.
Check out this tutorial here; it's using a csv but the idea is essentially the same:
https://medium.com/towards-entrepreneurship/importing-a-csv-file-from-github-in-a-jupyter-notebook-e2c28e7e74a5
I have an access to the not-mine private spreadsheet on the Google Sheet. When I access to that spreadsheet from browser, everything is fine. But, when I try to retrieve the content of that spreadsheet through Google Sheets API using Python, I am getting 403 error - "The caller does not have permission".
The problem is I can not ask the owner to give me one more permission for my API.
Can I retrieve the content of that spreadsheet somehow? Maybe using some tools?
You prolly can access it because you got the link from someone. But to access it using the API will require you to be added in the permissions. Worth checking would be this Google Drive SDK: Sharing Files tutorial video and the Permissions docs.
I'd like to use the Dropbox API (with access only to my own account) to generate a link to SomeFile.xlsx that I can put in an email to multiple Dropbox account holders, all of whom are presumed to have access to the file. I'd like for the same link, when clicked on, to talk to Dropbox to figure out where SomeFile.xlsx is on their local filesystem and open that up directly.
In other words, I do NOT want to link to the cloud copy of the file. I want to link to the clicker's locally-synced version of the file.
Does Dropbox have that service and does the API let me consume it? I haven't been able to discover the answer from the documentation yet.
No, Dropbox doesn't have an API like this.