google-drive-api

How to import a class/function in google Colab from a .py file on google drive

How to import a class/function in google Colab from a .py file on google drive Question: I am trying to import a class from a .py file which is stored in my google drive. Initially, I have mounted google drive as follows: from google.colab import drive drive.mount(‘/content/drive’) Then navigate into the destination folder using: %cd …

Total answers: 1

How to resume download using MediaIoBaseDownload with Google Drive and Python?

How to resume download using MediaIoBaseDownload with Google Drive and Python? Question: With large files I get various errors that stops the download, so I want to resume from where it stopped by appending to the file on disk properly. I saw that the FileIO has to be using ‘ab’ mode: fh = io.FileIO(fname, mode=’ab’) …

Total answers: 2

How to check share setting of gsheet by gspread

How to check share setting of gsheet by gspread Question: I want to check owner share settings of gsheets by using gsperad as below. img Now I can get the share data by use list_permissions(file_id) but I need more information about owner share settings by get True of False of Editors can change permissions and …

Total answers: 1

error uploading file to google drive with python

error uploading file to google drive with python Question: I wrote a code to upload (create and update) a file to google drive, in Windows 10 with python 3.9 it work, but in windows 2008 server with python 3.8 it give me an error. just to remember 3.8 is the max version that supports windows …

Total answers: 1

How to import a subset of a zip file into colab?

How to import a subset of a zip file into colab? Question: I have a very big zip file in my google drive which contain several subfloders. Now, I’d like to extract only a few subfolders (not all folder into colab). Is there any way for this? For instance, suppose the zip file name is …

Total answers: 2

Getting 'Invalid query' error when doing name='test' to Google Drive API

Getting 'Invalid query' error when doing name='test' to Google Drive API Question: I am using PyDrive to fetch list of file names from a Google Drive folder from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive GoogleAuth.DEFAULT_SETTINGS[‘client_config_file’] = r"client_secrets.json" gauth = GoogleAuth(settings_file=’settings.yaml’) drive = GoogleDrive(gauth) folder_id = "folder-id" file_list = drive.ListFile( { ‘q’: "name = ‘test’", …

Total answers: 1

uplad file to google drive with progress bar with python requests

uplad file to google drive with progress bar with python requests Question: This is my code for uploading to google drive with python requests using google-drive-api. import sys import json import requests from tqdm import tqdm import requests_toolbelt from requests.exceptions import JSONDecodeError class ProgressBar(tqdm): def update_to(self, n: int) -> None: self.update(n – self.n) def upload_file(access_token:str, …

Total answers: 3

Google Drive API v3 with Python to write data from revision file to pandas

Google Drive API v3 with Python to write data from revision file to pandas Question: I am using the Google Drive API to get file revisions, then I am interested in reading (not downloading) the contents of each file revision to a pandas dataframe. I have been able to get the revision Ids, but reading …

Total answers: 2

reading google gdoc in python

reading google gdoc in python Question: I am trying to develop a workflow to convert some txt files saved in google drive into markdown files using python. Below is the overview of what i am trying to do. The txt files are being uploaded to google drive. I was hoping I would access my google …

Total answers: 1