tanaike

The Thinker

Using Until Expiration Time of Access Token Retrieved By googleapis for Python

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.

Issue of HTML form with Input tab of Type File with google.script.run

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.

Retrieving Access Token from Service Account using oauth2client and google-auth with Python

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.

February 15, 2023: Decrypting Salted Base64 of finance.yahoo.com using Google Apps Script

Gists This sample script decrypts the salted base64 data of finance.yahoo.com using Google Apps Script. Recently, it seems that the specification of the key for decrypting the data has been changed on the server side, again. In this update, I looked for the logic for retrieving the key value. But, I cannot still find it. So, in this post, I would like to use a workaround discussed in this thread. In this thread, the valid keys are listed in a text file.

Putting Values of All Spreadsheets in Folder to Master Spreadsheet with Low Process cost using Google Apps Script

Gists This is a sample script for putting the values of all Spreadsheets in a folder to the master Spreadsheet with a low process cost using Google Apps Script. There is a case in that I want to collect the values from multiple Spreadsheets and put the values into the master Spreadsheet. When this situation is achieved by Google Apps Script, as the general method, the values are required to be retrieved from each Spreadsheet in a loop.