google-apps-script

Set height of Google Apps Script showModalDialog when using an HtmlService HtmlTemplate

大憨熊 提交于 2021-01-27 14:12:42
问题 I'm currently in the process of changing over my Google Apps Scripts that use the deprecated UI service to the HtmlService. I've created a modal dialogue using the following code (in a spreadsheet container-bound script): var htmlTemplate = HtmlService.createTemplateFromFile('testDialogue'); htmlTemplate = template.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME); SpreadsheetApp.getUi().showModalDialog(htmlTemplate, 'Test Dialogue'); The dialogue box opens, but I need to modify its

Google Apps Script - Convert HTML with styling to PDF and attach to an email - Create a PDF blob from HTML

百般思念 提交于 2021-01-27 14:10:17
问题 I would like the HTML from a Google Apps Script form, to get two different styles, one for the body of the email and another for the PDF file. Current code: function doGet(request) { return HtmlService.createTemplateFromFile('index') .evaluate();//not all caps but it has to match the name of the file and it doesn't - Change to PAGE } function include(filename) { return HtmlService.createHtmlOutputFromFile(filename) .getContent(); } /****** SHEET ****/ function userClicked(userInfo){ var url =

Google Apps Script - Convert HTML with styling to PDF and attach to an email - Create a PDF blob from HTML

你离开我真会死。 提交于 2021-01-27 14:01:02
问题 I would like the HTML from a Google Apps Script form, to get two different styles, one for the body of the email and another for the PDF file. Current code: function doGet(request) { return HtmlService.createTemplateFromFile('index') .evaluate();//not all caps but it has to match the name of the file and it doesn't - Change to PAGE } function include(filename) { return HtmlService.createHtmlOutputFromFile(filename) .getContent(); } /****** SHEET ****/ function userClicked(userInfo){ var url =

Google Apps Script function getActiveSheet() does not return active sheet

本小妞迷上赌 提交于 2021-01-27 13:52:35
问题 The Google Apps Script Developers' Guide's definition of an "active sheet": The active sheet in a spreadsheet is the sheet that is being displayed in the spreadsheet UI. If I have three sheets, named Mary, Moe, and Joe, and leave the Mary sheet on display (hence, it's the active sheet) and run this simple script: function myFunction() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); Logger.log(sheet.getName()); ss.setActiveSheet(ss.getSheets()[2]); Logger.log

Google Apps Script function getActiveSheet() does not return active sheet

百般思念 提交于 2021-01-27 13:24:26
问题 The Google Apps Script Developers' Guide's definition of an "active sheet": The active sheet in a spreadsheet is the sheet that is being displayed in the spreadsheet UI. If I have three sheets, named Mary, Moe, and Joe, and leave the Mary sheet on display (hence, it's the active sheet) and run this simple script: function myFunction() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); Logger.log(sheet.getName()); ss.setActiveSheet(ss.getSheets()[2]); Logger.log

Reverse Shortened URL to Get the Original URL Before the Shortening in Google Sheets

我是研究僧i 提交于 2021-01-27 13:14:55
问题 I have a sheet where I collect tweets with links based on a search query. Twitter, however, is handing me for each tweet their short URL format (t.co) rather than the original URL that was shared. Is there a way to use formulas or google code to retrace the short url and fetch the final destination URL? The original that was shared by the person authoring the tweet? What i have | what i'm looking for --------------------------------------------------------------------------- https://t​.co

How can I force all files in a folder to be owned by the folder owner in Google Drive?

自古美人都是妖i 提交于 2021-01-27 13:11:54
问题 I have several people contributing files to various folders in Google Drive. Each folder is for a specific project, and has an owner account named to match that project title. I want every file (and its descendants) in that parent folder to be owned by that project account. Eg the folder is called "Conferences", and is owned by the user "conferences.events@mydomain.com". All files uploaded/created into Conferences should be owned by the "conferences.events" account. What is the easiest way to

TypeScript classes order in Google AppScript Project

一曲冷凌霜 提交于 2021-01-27 12:17:21
问题 Suppose we have 2 simple TypeScript classes in 2 separate files: B.ts: namespace A{ export abstract class ItemBase { id:number=432; } } C.ts ///<reference path="B.ts"/> namespace A{ export class ItemType extends A.ItemBase{} } and invoking code in Code.ts: ///<reference path="C.ts"/> let a:A.ItemType=new A.ItemType(); Everything works well after pushing it using clasp But if I change the name of the C.ts file to AA.ts, I would get the error: TypeError: Cannot read property "prototype" from

Service Unavailable: DOCS when copying Google Docs

家住魔仙堡 提交于 2021-01-27 07:47:52
问题 Suddenly encountered one issue where Google DOCS service fails after making some calls to copy elements. Funny thing is that it actually copies the first element, but when it goes for the second loop within the "for" it fails giving this error: Service unavailable: Documents This script used to work fine for a few months as we have it published within our company. Suddenly last week it stopped working for all the users regardless of their browser etc... It is a script linked to a Google

How do I apply a script to only one sheet within a google spreadsheet

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-27 07:21:03
问题 I have a google spreadsheet with two sheets called Robin and Lucy. I've made/found/mangled a script to sort the data on the sheet each time I add some data to column A function onEdit(event){ var sheet = event.source.getActiveSheet(); var editedCell = sheet.getActiveCell(); var columnToSortBy = 1; var tableRange = "a2:I30"; if(editedCell.getColumn() == columnToSortBy){ var range = sheet.getRange(tableRange); range.sort( { column : columnToSortBy } ); } } This script works great, but I only