Directly Submitting Answers to Google Form using Google Apps Script

Gists

This is a sample script for directly submitting answers to Google Form using Google Apps Script.

The sample Google Form is as follows.

Directly Submitting Answers to Google Form using Google Apps Script

For this Google Form, this sample script submits the values of sample text, option2 and option1, option2, sample option to Google Form.

Sample script

For the multiple answers, it seems that it is required to send the values as the query parameter. I thought that the same key is used.

About Donation

From before, I have gotten several contacts about the donation to me. Thank you so much. So, today I could prepare the PayPal.Me. You can donate to me using the following URL.

https://paypal.me/tanaikech

Replacing Template Texts with Array in Google Document using Google Apps Script

Gists

This is a sample script for replacing the template texts with an array in Google Document using Google Apps Script. This is for Google Apps Script of this report.

The sample input and output situations are as follows.

Replacing Template Texts with Array in Google Document using Google Apps Script

In the current stage, when replaceAllText of Docs API is used with the sample value of ["updated text 1", "updated text 2", "updated text 3"], all values of {{oldText}} are replaced with the 1st value of updated text 1 in one batch request. So in order to replace each {{oldText}} with ["updated text 1", "updated text 2", "updated text 3"], it is required to use a workaround. So I proposed this report.

Replacing Template Texts with Array in Google Document using Docs API with Python

Gists

This is a sample script for replacing the template texts with an array in Google Document using Docs API with Python.

The sample input and output situations are as follows.

Replacing Template Texts with Array in Google Document using Docs API with Python

In the current stage, when replaceAllText of Docs API is used with the sample value of ["updated text 1", "updated text 2", "updated text 3"], all values of {{oldText}} are replaced with the 1st value of updated text 1 in one batch request. So in order to replace each {{oldText}} with ["updated text 1", "updated text 2", "updated text 3"], it is required to use a workaround.

Executing Function with Minutes timer in Specific Times using Google Apps Script

Gists

This is a sample script for executing a function with the minutes timer in the specific times using Google Apps Script. For example, when this sample script is used, the following situation can be achieved.

  • Execute a function every 10 minutes only in 09:00 - 12:00 and 15:00 - 18:00 for the weekday.

When the above situation is shown as an image, it becomes as follows.

Executing Function with Minutes timer in Specific Times using Google Apps Script

Simply Editing Texts of Texts Boxes on Google Slides using Google Apps Script

Gists

Simply Editing Texts of Texts Boxes on Google Slides using Google Apps Script

This is a sample script for simply editing the texts of texts boxes on Google Slides using Google Apps Script. The supposed situation is as follows.

  • Google Slides has several text boxes of the same size and the same position.
  • You want to retrieve the list of texts from the text boxes and want to change the texts using a simpler method.

In this case, I thought that when the sidebar created by Google Apps Script is used for changing the texts, your goal might be able to be simply achieved.

Benchmark: Concurrent Writing to Google Spreadsheet using Form

Gists

  • Published: September 15, 2021

  • Updated: September 17, 2021

    • From the discussions, added data by changing the wait time of LockService for Web Apps.

Kanshi Tanaike

Introduction

When the users try to write to a Spreadsheet using a form, the developers have to consider the concurrent submission from the form. For example, when multiple users submit the data with the form simultaneously, all data are possibly not to be saved to the Spreadsheet. So it is considered that it is important to know the information about the concurrent writing to Google Spreadsheet using a form. In this report, such a situation was investigated.

Using Google API Client Library (gapi) for JavaScript with Service Account

Gists

This is a sample script for using Google API Client Library (gapi) for JavaScript with the service account. Unfortunately, in the current stage, gapi cannot directly use the service account. So, in this case, it is required to implement the script for retrieving the access token from the service account. In this report, I would like to introduce the method for using gapi with the service account using a Javascript library.

Javascript library - GetAccessTokenFromServiceAccount_js

Overview

This is a Javascript library to retrieve the access token from the Google Service Account. Ref

Description

I have already posted the sample script for retrieving the access token from the Google Service Account. Ref But, when I use this script, I thought that when this was published as the Javascript library, it will be useful. So I created this.

Install

<script src="getaccesstokengromserviceaccount_js.min.js"></script>

Or, using jsdelivr cdn

<script src="https://cdn.jsdelivr.net/gh/tanaikech/GetAccessTokenFromServiceAccount_js@master/getaccesstokengromserviceaccount_js.min.js"></script>

You can see the detail of this at https://github.com/tanaikech/GetAccessTokenFromServiceAccount_js

Retrieving Hidden Rows and Showing Rows by Filter View on Google Spreadsheet using Google Apps Script

Gists

This is a sample script for retrieving the hidden rows and showing rows by the filter view on Google Spreadsheet using Google Apps Script. In the current stage, there are no methods for directly retrieving the hidden rows and showing rows by the filter view in Spreadsheet service (SpreadsheetApp). And, isRowHiddenByFilter of Class Sheet cannot be used for the filter view. But, fortunately, when Sheets API is used, the filter view can be retrieved and created. In this report, the hidden rows and showing rows by the filter view are retrieved using Sheets API.