Skip to content Skip to sidebar Skip to footer

Downloading Public Files In Google Drive (python)

Suppose that someone gives me a link that enables me to download a public file in Google Drive. I want to write a program that can read the link and then download it as a text file

Solution 1:

first you need to write a program that would slice off the link of the file that you have uploaded. for example in the link that you gave: https://docs.google.com/document/d/1yJVXtabsP7KrJXSu3XyOh-F2cFoP8Lftr14PtXCLEVU/edit

id is 1yJVXtabsP7KrJXSu3XyOh-F2cFoP8Lftr14PtXCLEVU

save it in some variable , say download_link now to get the download link: https://docs.google.com/uc?export=download&id=download_link this link will download the file

Solution 2:

If the above answer doesn't work for you use the following links :

to save as .txt file : https://docs.google.com/document/d/1yJVXtabsP7KrJXSu3XyOh-F2cFoP8Lftr14PtXCLEVU/export?format=txt

to save as docx file: https://docs.google.com/document/d/1yJVXtabsP7KrJXSu3XyOh-F2cFoP8Lftr14PtXCLEVU/export?format=docx

generally the trick is to add : export?format=txt instead of edit ! hope it helps.

Post a Comment for "Downloading Public Files In Google Drive (python)"