Skip to content

Instantly share code, notes, and snippets.

View techstreams's full-sized avatar

Laura Taylor techstreams

View GitHub Profile
@techstreams
techstreams / submit.md
Created June 18, 2020 15:40 — 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

@techstreams
techstreams / submit.md
Created June 18, 2020 15:40 — 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

@techstreams
techstreams / convertSpreadsheetToPdf.gs
Created December 23, 2019 19:12 — forked from andrewroberts/convertSpreadsheetToPdf.gs
Convert a multi-sheet Google Spreadsheet into a PDF, with option to email it.
/*
* Save spreadsheet as a PDF
*
* Based on Dr.Queso's answer in http://stackoverflow.com/questions/30367547/convert-all-sheets-to-pdf-with-google-apps-script/30492812#30492812
*
* @param {String} email Where to send the PDF [OPTIONAL]
* @param {String} spreadsheetId Or the active spreadsheet[OPTIONAL]
* @param {String} sheetName The tab to output [OPTIONAL]
* @param {String} PdfName [OPTIONAL]
*/
@techstreams
techstreams / gist:a3b3913c968738ecdf84c49ae2a16b67
Created December 6, 2019 15:40 — forked from dsottimano/gist:e3e6294f80cb1cbb526d1defed322850
Tech seo boost 2019 - Dave Sottimano - Apps script demo
//serpApiKey from serpapi.com
var GLOBAL_VARIABLES = {
serpApiKey : "add your api key"
}
/*
/***************************
/BEGIN PRESENTATION SCRIPTS
@techstreams
techstreams / submit.md
Created October 30, 2019 18:40 — forked from tanaikech/submit.md
Multipart-POST Request Using Google Apps Script

Multipart-POST Request Using Google Apps Script

April 20, 2019: GAS library for this situation was published. Please check it at https://github.com/tanaikech/FetchApp.

These sample scripts are for requesting multipart post using Google Apps Script.

In most cases, the multipart request is used for uploading files. So I prepared 2 sample situations as follows. For each situation, the request parameters are different.

  1. Upload a file from Google Drive to Slack.
  2. Convert an excel file to Spreadsheet on Google Drive using Drive API v3.
@techstreams
techstreams / get-set-html-quilljs-editor.js
Created May 17, 2019 15:36 — forked from fxmontigny/get-set-html-quilljs-editor.js
Insert and get html content with quilljs editor
const editor = $('.editor');
const quill = new Quill(editor);
// set html content
quill.setHTML = (html) => {
editor.root.innerHTML = html;
};
// get html content
@techstreams
techstreams / multi-git-win.md
Created March 1, 2019 21:48 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
  • In the installer, select everything but decide if you want a desktop icon (2nd step)
/**
* Get a GCS Signed URL
*
* @param {object} JSON credential
* @param {string} the base URL to sign
* @param {string} optional; TTL in seconds, defaults to 60
* @param {string} optional; the httpVerb, eg. 'GET','POST'; defaults to 'GET' if not specified
* @param {string} optional; the content type, ie. one of the valid mime content types. Your HTMLService HTTP header must set have a matching content type
* @return {string} The complete URL.
* @private
@techstreams
techstreams / downloadFileRange.gs
Created August 9, 2018 16:31 — forked from erickoledadevrel/downloadFileRange.gs
Downloading a portion of a Drive file in Apps Script.
function downloadFileRange(fileId, startByte, endByte) {
// Mention DriveApp in a comment to ensure the Drive scope is requested.
// DriveApp.getRootFolder();
var url = 'https://www.googleapis.com/drive/v3/files/' +
fileId + '?alt=media';
var response = UrlFetchApp.fetch(url, {
headers: {
Authorization: 'Bearer ' + ScriptApp.getOAuthToken(),
Range: 'bytes=' + startByte + '-' + endByte
}
@techstreams
techstreams / pdfExport.js
Created January 27, 2018 18:14 — forked from DimuDesigns/pdfExport.js
Apps Script PDF Export & Email
var spreadsheetId = "SPREADSHEET_ID",
sheetID = "SHEET_ID",
respondentEmail = "RESPONDENT_EMAIL";
var response = UrlFetchApp.fetch(
"https://docs.google.com/spreadsheets/d/" + spreadsheetId + "/export?" +
"format=pdf" +
"&size=2" +
"&fzr=true" +
"&portrait=false" + // you can change this to true for portrait mode