A Pen by Laura Taylor on CodePen.
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 |
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 | |
} |
/** | |
* 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 |
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.
- Download and install Git for Windows
- In the installer, select everything but decide if you want a desktop icon (2nd step)
const editor = $('.editor'); | |
const quill = new Quill(editor); | |
// set html content | |
quill.setHTML = (html) => { | |
editor.root.innerHTML = html; | |
}; | |
// get html content |
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.
- Upload a file from Google Drive to Slack.
- Convert an excel file to Spreadsheet on Google Drive using Drive API v3.
//serpApiKey from serpapi.com | |
var GLOBAL_VARIABLES = { | |
serpApiKey : "add your api key" | |
} | |
/* | |
/*************************** | |
/BEGIN PRESENTATION SCRIPTS |
/* | |
* 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] | |
*/ |
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.