Skip to content

Instantly share code, notes, and snippets.

View Oaphi's full-sized avatar
💭
☕ and 👩‍💻

Oleg Valter Oaphi

💭
☕ and 👩‍💻
  • Rocket
  • Saint Petersburg
View GitHub Profile
@Oaphi
Oaphi / PropertyLockService.js
Created August 7, 2020 13:06
PropertyLockService
var PropertyLock = (() => {
let locked = false;
let timeout = 0;
const store = PropertiesService.getScriptProperties();
const propertyName = "locked";
const triggerName = "PropertyLock.releaseLock";
@tanaikech
tanaikech / submit.md
Created August 3, 2020 05:37
IMPORTANT: reduceRight with and without v8 runtime for Google Apps Script

IMPORTANT: reduceRight with and without v8 runtime for Google Apps Script

This is an important point for using reduceRignt with and without v8 runtime for Google Apps Script.

Sample script

function myFunction() {
  var array = ["a", "b", "c", "d", "e"];
 var res = array.reduceRight(function (ar, e, i) {
@tanaikech
tanaikech / submit.md
Last active September 30, 2020 06:27
Drive API got to be able to create Google Apps Script project again

Drive API got to be able to create Google Apps Script project again

I have reported "Drive API cannot create Google Apps Script project no longer". Ref About this, I had reported the future request. Ref Today, I could confirm that the Google Apps Script project of the standalone type got to be able to be created by multipart/form-data using Drive API. This is a good news for me. By this, the following 2 patterns can be used from now.

Pattern 1:

  1. Create new standalone GAS project by Apps Script API.
  2. Put the local script to the created GAS project by updating the project with Apps Script API.
  3. Move the GAS project from the root folder to the specific folder using Drive API.

In this pattern, 3 API calls are required.

@tanaikech
tanaikech / submit.md
Last active July 30, 2020 06:52
Workaround: Showing Log in Web Apps to Apps Script Dashboard using Javascript

Workaround: Showing Log in Web Apps to Apps Script Dashboard using Javascript

I have already reported for showing the log to "Apps Script Dashboard" when it requests to the Web Apps. Ref In order to show the log to "Apps Script Dashboard" when it requests to the Web Apps, it is required to use the access token. But in the current stage, when the access token is used for XMLHttpRequest and fetch of Javascript in the request headers, the error related to CORS occurs. So, in this report, I would like to propose the workaround for resolving this issue.

Workaround

In this workaround, the access token is NOT used for requesting with Javascript. Javascript which is the client side requests to the Web Apps without the access token. By this, no error occurs.

At Web Apps which is the server side, the log is shown in "Apps Script Dashboard" using the access token.

@tanaikech
tanaikech / submit.md
Last active March 1, 2024 12:17
Logs in Web Apps for Google Apps Script

Logs in Web Apps for Google Apps Script

This is a report for retrieving the logs in Web Apps for Google Apps Script, when it requests to the Web Apps.

Experimental condition

1. Sample script for Web Apps

const doGet = (e) => {
@tanaikech
tanaikech / submit.md
Last active July 16, 2020 01:52
Tags Using Together with google-apps-script Tag at Stackoverflow

Tags Using Together with google-apps-script Tag at Stackoverflow

This table shows all tags using together with the tag of "google-apps-script" at Stackoverflow. The tags are summarized every year. At 2020, the data is retrieved from January 1, 2020 to July 16, 2020. The number enclosed (###) means the number of use of the tag. When this table was a material for discussing about the current tags for "google-apps-script", I'm glad.

| Year | Used Tag list | | :

@tanaikech
tanaikech / submit.md
Created July 15, 2020 00:18
Statistics of gas Tag on Stackoverflow

Statistics of gas Tag on Stackoverflow

This is the statistics for the tag gas on Stackoverflow. This statistics are retrieve from Stackoverflow using Stackexchange API. About 2020, the data is retrieved from 2020-01-01 to 2020-07-01.

This statistics data was obtained at 2020-07-15.

Measurement result

@tanaikech
tanaikech / submit.md
Last active July 8, 2020 08:21
Statistics of appscript Tag on Stackoverflow

Statistics of appscript Tag on Stackoverflow

This is the statistics for the tag appscript on Stackoverflow. This statistics are retrieve from Stackoverflow using Stackexchange API. About 2020, the data is retrieved from 2020-01-01 to 2020-07-01.

Recently, this tag is modified by editing the tags. So I think that it has to be said that this statistics data is obtained at 2020-07-06.

Measurement result

@tanaikech
tanaikech / submit.md
Last active March 15, 2022 15:26
Benchmark: Process Costs under V8 using Google Apps Script

Benchmark: Process Costs under V8 using Google Apps Script

  • March 22, 2020
    • Published.

Kanshi Tanaike

Introduction

@Oaphi
Oaphi / asyncGAPI.js
Last active February 24, 2021 15:27
Async-friendly google.script.run utility
/**
* Promise-friendly google.script.run call
* @param {String} funcName
* @param {...*} params
* @returns {Promise}
*/
const asyncGAPI = (funcName, ...params) => {
return new Promise((res, rej) => {
google.script.run
.withSuccessHandler(data => res(data))