Gists
This is a sample script for retrieving the total file sizes in the specific folder of Google Drive using Google Apps Script.
There is a case where you want to retrieve the total file sizes in the specific folder of Google Drive using Google Apps Script. In this post, I would like to introduce a sample script for achieving this.
Sample script Before you use this script, please enable Drive API at Advanced Google services.
Gists
This is a sample script for retrieving the start and end row numbers of the same values in a column on Google Spreadsheet using Google Apps Script.
There is a case in that I want to retrieve the rows of the same values in a column on Google Spreadsheet using Google Apps Script. In this post, I would like to introduce a simple sample script for achieving this.
Sample script function myFunction() { const sheet = SpreadsheetApp.
Gists
When Google APIs are used with googleapis for Python, the client is obtained as follows.
creds = service_account.Credentials.from_service_account_file(service_account_credential_file, scopes=scopes) service = build("drive", "v3", credentials=creds) In this case, when the script is run, the access token is retrieved every time. But, the expiration time of the retrieved access token is 1 hour. Here, there might be the case that you want to use the access token until the expiration time. It is considered that effectively using the access token will lead to SDGs.
Gists
Today, I discussed with Riƫl Notermans an issue with the HTML form with the input tab of type="file" with google.script.run. Through this discussion, the reason for this issue could be found. When you use the input tab of type="file" in the HTML form, and you want to send the file content with google.script.run, I thought that this post might be useful for other users. So, I posted it here.
Gists
This is a sample script for retrieving the access token from the service account using oauth2client and google-auth with Python.
Sample script 1 Use oauth2client.
from oauth2client.service_account import ServiceAccountCredentials SERVICE_ACCOUNT_FILE = "credentials.json" SCOPES = ["https://www.googleapis.com/auth/drive"] creds = ServiceAccountCredentials.from_json_keyfile_name(SERVICE_ACCOUNT_FILE, scopes=SCOPES) res = creds.get_access_token() access_token = res.access_token print(access_token) Sample script 2 Use google-auth. In the current stage, this method might be general.
from google.oauth2 import service_account import google.auth.transport.requests SERVICE_ACCOUNT_FILE = "credentials.