tanaike - Google Apps Script, Gemini API, and Developer Tips

The Thinker

Adjusting Text Length to Fit in Cell Width on Google Spreadsheet using Google Apps Script

Gists This is a sample script for adjusting the text length to fit in the cell width on Google Spreadsheet using Google Apps Script. In this case, in order to fit to the cell width, the font size is changed. Issue and workaround: Unfortunately, in the current stage, there are no methods for automatically resize the font size for fitting in the cell width in the Spreadsheet service. So in this case, it is required to think of the workaround.

Updated: Taking advantage of Web Apps with Google Apps Script

New section CORS in Web Apps was added to Taking advantage of Web Apps with Google Apps Script In this section, I would like to introduce CORS in Web Apps. As the result, in order to prevent the error related to CORS, it was found the following important points. It is required to return ContentService.createTextOutput() and ContentService.createTextOutput("done") from doGet and doPost. For POST method, the data is required to be converted to the string and sent to Web Apps.

Report: Processing to Create New File to Specific Folder using Drive API

Gists In this report, I would like to report for processing to create new file to the specific folder using Drive API. When the new file is created to the specific folder using Drive API, the property of parents with the value of folder ID is included in the request body of the method “Files: create”. About this process, I had thought that the file is directly created to the specific folder.

Update JSON object using jq

Gists Achieving the following conversion using jq. In this conversion, when key2 is true, updated_ is added to the value of key1 and the value of key2 is 2 times and key2a is added by adding updated_ to the value as new property. Conversion From [ { "key1": "value1", "key2": 123, "key3": true }, { "key1": "value2", "key2": 456, "key3": false }, { "key1": "value3", "key2": 789, "key3": true } ] To [ { "key1": "updated_value1", "key2": 246, "key2a": "updated_123", "key3": true }, { "key1": "value2", "key2": 456, "key3": false }, { "key1": "updated_value3", "key2": 1578, "key2a": "updated_789", "key3": true } ] Command $ echo '[{"key1":"value1","key2":123,"key3":true},{"key1":"value2","key2":456,"key3":false},{"key1":"value3","key2":789,"key3":true}]' | jq '[.

Search Dialog Sample using TextFinder with Google Apps Script

Gists This is a sample script for the search dialog using TextFinder with Google Apps Script. If this sample script could help to indicate the possibility of TextFinder, I’m glad. Demo In this demonstration, the value of test is searched. When "NEXT" is clicked, the next searched value is activated. When "PREVIOUS" is clicked, the previous searched value is activated. The search can be done for all sheets in the Google Spreadsheet.