tanaike

The Thinker

Retrieving Glyph Value from List Items of Google Document using Google Apps Script

Gists This is a sample script for retrieving the glyph value from the list items of Google Document using Google Apps Script. In the current stage, when the list is put to the Google Document, the count of glyph is automatically calculated. When the glyph values of the list items are tried to be retrieved using the manual operation and the script, unfortunately, the glyph values cannot be retrieved. Only the values of the list are retrieved.

Report: Images put with IMAGE function on Google Spreadsheet

Gists This is a report about images put with “=IMAGE(IMAGE_URL)” function on Google Spreadsheet. Experiment When “=IMAGE(IMAGE_URL)” is put to a cell “A1” on Spreadsheet, the image is shown in the cell as shown in the following image. For this situation, when the following script is run, const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); const range = sheet.getRange("A1"); range.copyTo(range, { contentsOnly: true }); The following result is obtained. In this case, the formula is removed and an image can be seen as shown in the following image.

File Picker using Google Apps Script and Javascript without 3rd party

GitHub This is a sample script for the file picker using Google Apps Script and Javascript without 3rd party. I had created the same sample script before. Ref But, in the case of that script, jQuery is used. And, only Google Drive of own account could be used. In this sample script, 3rd party of jQuery is not used, and also, not only Google Drive of your own account, but also Google Drive of the service account can be used.

Converting Values of Google Spreadsheet to Object using Google Apps Script

Gists This is a sample script for converting the values of Google Spreadsheet to an object using Google Apps Script. Sample script function myFunction() { const sheetName = "Sheet1"; const [headers, ...rows] = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName).getDataRange().getValues(); const res = rows.map((r) => headers.reduce((o, h, j) => Object.assign(o, { [h]: r[j] }), {})); console.log(res); } When this script is run, the above sample image can be retrieved. In this sample script, the 1st row of the sheet is used as the header row.

Updated: GAS Library - RichTextApp

RichTextApp was updated to v1.3.0 v1.3.0 (October 20, 2021) Added a new method of RangeToHTMLTableForSpreadsheet. In this method, the range on Google Spreadsheet is converted to a HTML table. Using this method, for example, you can send the specific range in the Spreadsheet as an email by including a HTML table. You can see the sample HTML table at https://jsfiddle.net/oq9x458e/. I used this method for this thread of Stackoverflow.