google-drive-api

Image crop with AppScripts in Sheets or Drive

我的梦境 提交于 2021-02-11 04:19:20
问题 I am evaluating Google Sheets with AppScripts for a report generator. The requirements include inserting images from Google Drive. One of the input image has a fix format, which I need to crop. ( So the dimensions of the original image and the dimensions of the crop is known.) I am looking for a solution to achieve this outcome, but I am struggling. I looked into the following methods: No image crop function in the Drive API No image crop ( only resize) for the Sheets OverGridImage object No

Upload an image to Google Drive with OCR and convert to Doc

爷,独闯天下 提交于 2021-02-10 22:26:11
问题 I want to upload an image to Google Drive with OCR function and convert it to Google Doc. I am using this method public static File UploadFile(DriveService Service, string UploadFile, string Parent) { if (System.IO.File.Exists(UploadFile)) { File body = new File(); body.Title = System.IO.Path.GetFileName(UploadFile); body.Description = "File uploaded by Diamto Drive Sample"; body.MimeType = GetMimeType(UploadFile); body.Parents = new List<ParentReference>() { new ParentReference() { Id =

How to know through APIs who created the file in Shared Drive (Team Drive) in Google Drive

混江龙づ霸主 提交于 2021-02-10 22:24:44
问题 All the files in Shared drive (Team Drive) in google drive are accessible by all users who have access to Shared Drive (Team Drive). When a new file is created in a Shared Drive(Team Drive) by default all the users with access to Shared Drive(Team Drive) will become owners as well. Question : when we list the files using APIs inside a folder in Shared Drive (Team Drive), how to detect who created the file ? 回答1: You can use the Revisions API So, if you list the revisions of a file specifying

Upload an image to Google Drive with OCR and convert to Doc

 ̄綄美尐妖づ 提交于 2021-02-10 22:21:49
问题 I want to upload an image to Google Drive with OCR function and convert it to Google Doc. I am using this method public static File UploadFile(DriveService Service, string UploadFile, string Parent) { if (System.IO.File.Exists(UploadFile)) { File body = new File(); body.Title = System.IO.Path.GetFileName(UploadFile); body.Description = "File uploaded by Diamto Drive Sample"; body.MimeType = GetMimeType(UploadFile); body.Parents = new List<ParentReference>() { new ParentReference() { Id =

google drive api v3 update description

回眸只為那壹抹淺笑 提交于 2021-02-10 22:18:28
问题 google drive api v3 I need to change the description of an existing object. How do I change just that, leaving the rest unchanged? I am doing by analogy with python. I get the file metadata, add the "description" line to it and execute update. There are no errors, the description simply does not change I don't know much about js, I will be glad if you can help me. thanks function updateFile(fileId) { var request = gapi.client.drive.files.get({ 'fileId': fileId }); request.execute(function

google drive api v3 update description

☆樱花仙子☆ 提交于 2021-02-10 22:15:11
问题 google drive api v3 I need to change the description of an existing object. How do I change just that, leaving the rest unchanged? I am doing by analogy with python. I get the file metadata, add the "description" line to it and execute update. There are no errors, the description simply does not change I don't know much about js, I will be glad if you can help me. thanks function updateFile(fileId) { var request = gapi.client.drive.files.get({ 'fileId': fileId }); request.execute(function

Error: 413 Request Too Large - Python Google Drive API with resumable MediaIoBaseUpload Request

泄露秘密 提交于 2021-02-10 20:17:19
问题 This seems to follow the documented pattern available in other examples found in the documentation and on stack overflow, but the problem is unresolved in the code sample below. Here, there seems to be more to the story... Here's the code: ... drive_service = build('drive', 'v3', credentials=credentials, cache_discovery=False) file_metadata = { 'name': filename, 'mimeType': 'application/vnd.google-apps.spreadsheet', 'parents': ['1c7nxkdgHSnL0eML5ktJcsCRVfEsBD0gc'] } media = MediaIoBaseUpload

Error: 413 Request Too Large - Python Google Drive API with resumable MediaIoBaseUpload Request

淺唱寂寞╮ 提交于 2021-02-10 20:15:58
问题 This seems to follow the documented pattern available in other examples found in the documentation and on stack overflow, but the problem is unresolved in the code sample below. Here, there seems to be more to the story... Here's the code: ... drive_service = build('drive', 'v3', credentials=credentials, cache_discovery=False) file_metadata = { 'name': filename, 'mimeType': 'application/vnd.google-apps.spreadsheet', 'parents': ['1c7nxkdgHSnL0eML5ktJcsCRVfEsBD0gc'] } media = MediaIoBaseUpload

Error saving files into google drive via google colab

℡╲_俬逩灬. 提交于 2021-02-10 20:07:54
问题 I am trying to save files onto my Google Drive from a colab notebook and I keep getting the same error. I have already mounted my drive. When I call pwd, I get, which seems right: /content/drive/My Drive/ Here is an example code and read-out: from google.colab import drive drive.mount('/content/drive') import pandas as pd import numpy as np df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD')) print(df) df.to_csv('test.csv') A B C D 0 38 28 18 74 1 36 54 84 13 2 2 1

Google Drive API Insufficient Permission: Request had insufficient authentication scopes

Deadly 提交于 2021-02-10 17:53:51
问题 I successfully completed the quickstart shows HERE: https://developers.google.com/drive/api/v3/quickstart/python I wish to go further and begin to upload files and folders. To do so I have replaced the scope with: SCOPES = ['https://www.googleapis.com/auth/drive'] I have also replaced the execution with national_parks = ['Yellowstone', 'Rocky Mountain', 'Yosemite'] for national_park in national_parks: file_metadata = {'name': national_park, 'mimeType': 'application/vnd.google-apps.folder' #