google-docs

Insert a table into google doc at cursor position

天涯浪子 提交于 2020-01-01 09:18:22
问题 I am working on a Google Docs add on that turns text into a table. It allows the user to either 1) select some text or 2) place their cursor inside the text they want, and when a custom button in the sidebar is clicked, the script will: Insert a single row, single cell table at the cursor position or the startIndex of the selected text, Place inside that cell either the text a user has selected or the complete text of the element in which the cursor is placed, Delete the original selected

How to copy one or more existing pages of a document using google apps script

谁说胖子不能爱 提交于 2020-01-01 06:54:06
问题 I have sucessfully written a small script, which creates a serial letter (physical letter to several recipients) based on data in a Google spreadsheet creating a new document for each letter/addresse. It works, but for large mailings this approach is a bit cumbersome as a large amount of documents are created and need to be printed individually. Now i would like to do the same but as a result having all of the letters in one single Google document. Is there any way to copy the content of an

How to generate a pre-filled form URL for Google Form

旧城冷巷雨未停 提交于 2019-12-31 10:37:23
问题 I'm looking for a programmatic way to automate the generation of pre-filled URLs for google forms. In a recent update, Google introduced a new Forms product to Google Docs. If you open the tools menu in a spreadsheet, you'll see some new options. In the new Form Responses menu, one option is "Get pre-filled URL". This opens up a dialog containing a version of your form that you can fill out, and when you submit it, you receive a URL that can be used to open a Live Form with the data you pre

How does the Google Docs PDF viewer work?

爱⌒轻易说出口 提交于 2019-12-31 08:24:53
问题 I am curious to know how the Google Docs PDF viewer works? It's not a flash like scribd.com; it looks like pure HTML. Any idea how do they did it? Sample link to view the PDF 回答1: Google is simply serving up an an image (right click -> save as), with an overlay to highlight text. You should check out this SO question where others go into more detail. You should also look through the source of your PDF link, it would appear Google are passing the PDF link through to be converted into an image.

Can't stop Google Apps Script from masking redirected URL

与世无争的帅哥 提交于 2019-12-31 05:57:09
问题 I have a doGet function in my google apps script (attached to a google doc) which is published as a web app and I want the user to be redirected to another web page. Importantly, I want the URL of the page they are redirected to to be displayed in the address bar, and the title of the page they are redirected to to be the title of the tab (in Chrome). I've tried using a meta refresh tag, and also setting the window.location.href. Both of these redirect correctly but they show the URL of the

How to add Header/Footer to with Google Docs API

◇◆丶佛笑我妖孽 提交于 2019-12-31 05:45:13
问题 I want to add header and footer to an existing Google Docs file using Google Docs API. Looking at the documents.batchUpdate (link) we can insert text, replace text, add images and table etc by mentioning them in the JSON payload with objects like replaceAllText , insertText etc but I cannot find any way to insert header and footer. Question 1: How can I add header and footer? Question 2: How can I add different header/footer for the first page of document? If not possible, suggestion to use

Embedded Google Docs PDF viewer displays login page rather than PDF

♀尐吖头ヾ 提交于 2019-12-31 01:43:09
问题 I have a Web page in which I embed a Google docs viewer in an iFrame <iframe src="http://docs.google.com/viewer?url=URL-encoded-URL&embedded=true" width="750" height="960" style="border: none;"></iframe> (where URL-encoded-URL is an actual encoded URL). For many/most of my users, the Google PDF Doc viewer appears and displays the referenced PDF. But some of my users instead see the Google Docs page with the login box. I've no idea why that happens. Has anyone heard of this happening? And more

Google Apps Script; Docs; convert selected element to HTML

爷,独闯天下 提交于 2019-12-30 11:25:07
问题 I am just starting with Google Apps Script and following the Add-on quickstart https://developers.google.com/apps-script/quickstart/docs In the quickstart you can create a simple add-on to get a selection from a document and translate it with the LanguageApp service. The example gets the underlying text using this: function getSelectedText() { var selection = DocumentApp.getActiveDocument().getSelection(); if (selection) { var text = []; var elements = selection.getSelectedElements(); for

how to open specific page on Google's docs viewer

♀尐吖头ヾ 提交于 2019-12-29 14:19:17
问题 I'm using google's docs viewer to show a pdf document in a html page and I would like to open the document starting on page 20 instead of 1 for example. There's hardly any documentation about Google's docs viewer service. They say in its webpage https://docs.google.com/viewer that the service only accepts two parameters (url and embedded) but I've seen other parameters searching the web, like "a", "pagenumber", "v" and "attid", none of them did anything to me. I've tried to add #:0.page.19 at

Created PDF does not reflect changes made to the original document

一曲冷凌霜 提交于 2019-12-29 01:30:31
问题 I have a Google Docs template which is automatically copied into a folder and replace specific values with values coming from spreadsheet cells. The template contains values such as <<41>> which are used to be "find-and-replaced" with values coming from a spreadsheet. The find-and-replace process is fine, and the results of the document looks like this image below Now, I want this document to be converted into PDF after it has been updated, so I made a function for the convertion and call it