This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Function to convert a given Google Spreadsheet [Sheet] into a PDF. | |
* | |
* @param {string} key This is the Id of the Sheet to be converted bothe the DocsList.getId() and the SpreadsheetApp.getId() versions work | |
* @param {string} name [Optional] Intended Filename. If omitted, uses the Sheet filename. | |
* @param {object} options Settings object for the crafting of the PDF. Defaults to A4, no gridline print etc. <pre> | |
* { | |
* format:Enum, | |
* size:Enum, | |
* headers: Bool, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Invokes a function, performing up to 5 retries with exponential backoff. | |
* Retries with delays of approximately 1, 2, 4, 8 then 16 seconds for a total of | |
* about 32 seconds before it gives up and rethrows the last error. | |
* See: https://developers.google.com/google-apps/documents-list/#implementing_exponential_backoff | |
<h3>Examples:</h3> | |
<pre>//Calls an anonymous function that concatenates a greeting with the current Apps user's email | |
var example1 = GASRetry.call(function(){return "Hello, " + Session.getActiveUser().getEmail();}); | |
</pre><pre>//Calls an existing function | |
var example2 = GASRetry.call(myFunction); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myFunction() { | |
var option = googleOAuth_(); | |
option.method = "post"; | |
option.contentType = 'application/json'; | |
option.payload = JSON.stringify({ | |
"query": | |
{ | |
"kinds": | |
[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FAQ | |
Why open a new window for the authorization? | |
Because if you load the contents of the auth page directly IN a sidebar (or script) using HtmlService, its buttons won't work because they've been cajoled. | |
Why not just the the access token provided by GAS Libraries? | |
Because lord only knows what that thing is scoped for. | |
How do I clear my token? | |
Pass ?reset parameter to the url, or call clearMyAuthToken() directly. |