Skip to content

Instantly share code, notes, and snippets.

View Lockyc's full-sized avatar
:octocat:
to be a philosopher, one must axolotl questions

Lachlan Collins Lockyc

:octocat:
to be a philosopher, one must axolotl questions
View GitHub Profile
@Lockyc
Lockyc / submit.md
Created December 10, 2021 00:11 — forked from tanaikech/submit.md
Taking Advantage of TextFinder for Google Spreadsheet

Taking Advantage of TextFinder for Google Spreadsheet

There is Class TextFinder in Spreadsheet service for Google Apps Script. Ref The TextFinder can search and replace the texts in the Spreadsheet using Google Apps Script. There is the method for createTextFinder in Class Spreadsheet, Class Sheet and Class Range. When these methods are used, you can search and replace the texts for all sheets in a Spreadsheet, the specific sheet, and the specific range in the specific sheet.

In this post, I would like to introduce the sample scripts for taking advantage of TextFinder.

I think that TextFinder is the strong method for searching values in Google Spreadsheet. Ref So I think that when this can be taken advantage of, the process cost of the script will become low.

Sample script 1

@Lockyc
Lockyc / submit.md
Created December 10, 2021 00:12 — forked from tanaikech/submit.md
Downloading Google Spreadsheet as XLSX and PDF file by Clicking Button

Downloading Google Spreadsheet as XLSX and PDF file by Clicking Button

This is a sample script for downloading Google Spreadsheet to the local PC as a XLSX file and a PDF file when a button on the side bar and the dialog is clicked. This is created with Google Apps Script and HTML&Javascript.

Sample script

Please create new Google Spreadsheet and copy and paste the following scripts to the script editor. And please run openSidebar(). By this, the side bar is opened to the Spreadsheet.

@Lockyc
Lockyc / submit.md
Created December 10, 2021 00:16 — forked from tanaikech/submit.md
Uploading Files of multipart/form-data to Google Drive using Drive API with Node.js

Uploading Files of multipart/form-data to Google Drive using Drive API with Node.js

These are the sample scripts for uploading files of multipart/form-data to Google Drive using Drive API with Node.js. In this case, googleapis for Node.js is not used.

In these sample script, the maximum file size is 5 MB. Please be careful this. When you want to upload the files more than 5 MB, please check this report.

Sample script 1

This sample script uploads a file using the modules of fs and request. Before you use this script, please prepare your access token for uploading the file.

@Lockyc
Lockyc / submit.md
Created December 10, 2021 00:17 — forked from tanaikech/submit.md
Search Dialog Sample using TextFinder with Google Apps Script

Search Dialog Sample using TextFinder with Google Apps Script

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.

@Lockyc
Lockyc / submit.md
Created December 10, 2021 00:18 — forked from tanaikech/submit.md
Updating a File with Resumable Upload using Drive API

Updating a File with Resumable Upload using Drive API

This is a sample flow for updating a file with the resumable upload using Drive API.

Sample situation:

In this answer, as a sample situation, it supposes that a text file in Google Drive is updated by the resumable upload with the multiple chunks. And as the method for requesting, I use the curl command.

I prepared 2 files for 2 chunks. As the test situation, the 2 chunks of 262,144 bytes and 37,856 bytes are uploaded. So total upload size is 300,000 bytes. Those filenames are data1.txt and data2.txt, respectively.

@Lockyc
Lockyc / Info.plist
Created September 4, 2023 06:34 — forked from georgebrock/Info.plist
AppleScript to handle URLs
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<!-- Add this section: -->
<key>CFBundleURLTypes</key>
<array>
<dict>
@Lockyc
Lockyc / submit.md
Created January 13, 2024 07:38 — forked from tanaikech/submit.md
Disabling Buttons Put on Google Spreadsheet using Google Apps Script

Disabling Buttons Put on Google Spreadsheet using Google Apps Script

Description

This is a sample script for disabling the buttons put on Google Spreadsheet using Google Apps Script.

When a script is run by clicking a button on Google Spreadsheet, there is the case that you don't want to make users run the script in duplicate. This sample script achieves this situation.

Demo