google-docs

How to convert LaTeX equation into editable equation using Google Apps Script

元气小坏坏 提交于 2020-08-22 04:54:15
问题 tldr: How can I convert a LaTeX equation in Google Docs so that it is editable as a Google Doc equation? Background: I want to import html into Google Docs. This HTML includes (in my native database) LaTeX equations. When I import to Google Docs, the LaTeX is converted into non-editable images. I want to convert the LaTeX into editable Google equations. I'm thinking I can use Google Apps Scripts to accomplish this. My plan is to insert the equations as a text-string "tag" such as [latex: x +

Run trigger at specific date and time

我是研究僧i 提交于 2020-08-11 07:30:26
问题 I want to run a trigger at specific date and time (+or - 15 min). I have a date min string with YYYY-MM-DD HH:MM format say 2017-04-01 18:05 How will I modify the below script to run at 18 hours and 5 minutes. var triggerDay = new Date(2017, 04, 01); ScriptApp.newTrigger("myFunction") .timeBased() .at(triggerDay) .create(); 回答1: You can try this: function createTimeDrivenTriggers() { // Trigger on 2017-04-01 around 18:00 (±15 min). ScriptApp.newTrigger('myFunction') .timeBased() .atDate(2017,

Execute HtmlOutput code in Google App Script without opening a sidebar

。_饼干妹妹 提交于 2020-08-09 09:01:12
问题 edit: wound up using cheerio to manipulate the elements instead of creating them in a sidebar. Is it possible to create an execute htmlOutput in a background page, or do so without showing the user anything? Sample code below: plugin.gs function onOpen(e) { DocumentApp.getUi().createAddonMenu() .addItem('Start', 'run') .addToUi(); } /** * Opens a sidebar in the document containing the add-on's user interface. */ function run() { var ui = HtmlService.createTemplateFromFile('sidebar').evaluate(

Inserting image into Google Doc with apps script says invalid image data

旧时模样 提交于 2020-07-22 18:26:15
问题 I am trying to insert all images from a Google Drive folder into a Google document. But on insertImage I always get an "invalid image data" error. function myFunction() { var folder = DriveApp.getFolderById(id); var files = folder.getFiles(); while (files.hasNext()) { var file = files.next(); var img = file.getBlob(); var imgDoc = DocumentApp.getActiveDocument().getBody().insertImage(0, img); } } There are numerous examples that explain how to do this, and all say to get the image blob and

How to apply google appscript to all google docs

泪湿孤枕 提交于 2020-07-22 06:10:46
问题 Below solution is intended to generate auto-increment ID as replacement to default name "Untitiled document" of googledocs. Autoincrement filename in Google Docs? The solution was clear to me. However, I'm thinking an option on how to apply this script to all google docs that will be created on the fly ? Maybe add-ons ? 回答1: Answer: Auto-renaming documents can't be done on-the-fly, that is to say, there is no way of making a script run automatically on document creation. You can however check

Is it possible to send HTTP request from inside Google docs?

有些话、适合烂在心里 提交于 2020-07-18 08:46:06
问题 I want to send an HTTP request to some REST service from Google drive spreadsheet. Is this possible? 回答1: Using Google Apps Script, you can make HTTP requests to external APIs from inside Google Docs/Sheets/etc. using the UrlFetchApp class: var url = 'https://gdata.youtube.com/feeds/api/videos?' + 'q=skateboarding+dog' + '&start-index=21' + '&max-results=10' + '&v=2'; var response = UrlFetchApp.fetch(url); Logger.log(response); Note that: This service requires the https://www.googleapis.com

Block Website Scraping by Google Docs

一世执手 提交于 2020-07-18 03:46:30
问题 I run a website that provides various pieces of data in chart/tabular format for people to read. Recently I've noticed an increase in the requests to the website that originate from Google Docs. Looking at the IPs and User Agent, it does appear to be originating from Google servers - example IP lookup here. The number of hits is in the region of 2,500 to 10,000 requests per day. I assume that someone has created one or more Google Sheets that scrape data from my website (possibly using the

Block Website Scraping by Google Docs

百般思念 提交于 2020-07-18 03:46:19
问题 I run a website that provides various pieces of data in chart/tabular format for people to read. Recently I've noticed an increase in the requests to the website that originate from Google Docs. Looking at the IPs and User Agent, it does appear to be originating from Google servers - example IP lookup here. The number of hits is in the region of 2,500 to 10,000 requests per day. I assume that someone has created one or more Google Sheets that scrape data from my website (possibly using the

Calling library function from html in that library

筅森魡賤 提交于 2020-07-10 10:42:55
问题 In order to share with my colleagues the AppsScript code I am developing, I created a standalone project used as a library in our Docs template. This library contains: a .gs file for the server side code a .html file for the client side sidebar In the sidebar, I have a button which triggers a call to a function from the library with a parameter. The javascript call is the following: google.script.run .withFailureHandler( function(msg, element) { showError(msg, $('#button-bar')); }) .test(); I

Update/Replace inline image on Google Document

☆樱花仙子☆ 提交于 2020-07-05 03:45:12
问题 I'm trying to set a feature to update images on a Google Document, the same way Lucidchart Add-on does on its "Updated inserted diagram" feature. For this, I'm current doing the following: Creating a Named Range and storing its id on document properties, together with the data to generate the image, for later retrieve. On update, call body.getNamedRangeById() and replace the element with the new generated image. This works, but I have the following problems that does not happen with