Skip to content

Instantly share code, notes, and snippets.

Create menu item to run script from spreadsheet.
function onOpen() {
.createMenu('Create Doc')
.addItem('Create Doc', 'getSpreadsheetData')
init by gas-hub, just delete this file.
michaelos02 /
Created November 30, 2019 20:29
Counting Pages in Google Doc - can't be done BUT if you make it a PDF you can. Here is link:
function getNumPages() {
var blob = DocumentApp.getActiveDocument().getAs("application/pdf");
var data = blob.getDataAsString();
var pages = parseInt(data.match(/ \/N (\d+) /)[1], 10);
Logger.log("pages = " + pages);
return pages;
michaelos02 / index.html
Created March 28, 2019 14:57
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<div class="trans">What?</div>