google-docs

How can I move the cursor to the beginning of the document with Google Apps Script for Docs?

我怕爱的太早我们不能终老 提交于 2019-12-10 13:47:12
问题 I am writing a script of Google Apps Script with my Google Document and wondering how to move the cursor to the very beginning of the document. What I was trying to do at the end is just replace the first line with some string. 回答1: This is very simple, you can use the setCursor() method documented here. Example code : function setCursorToStart() { var doc = DocumentApp.getActiveDocument(); var paragraph = doc.getBody().getChild(0); var position = doc.newPosition(paragraph.getChild(0), 0);

Find & replace in files within a folder using Google Apps Script

依然范特西╮ 提交于 2019-12-10 11:46:21
问题 Could you post a Snippet that does find & replace across all files within a folder please? I did find something similar, Google Scripts - Find and Replace Function that searches multiple documents but that one search in every file in Google Drive, not within a folder. Since I'm only learning Google Apps Script by example now, I can't make that tiny step myself. EDIT: Further on the replacing part. The DocumentApp.openById returns a type of Document right? However, I can't find the replaceText

Remove row of table in a Google Document with Google Apps Script

青春壹個敷衍的年華 提交于 2019-12-10 10:56:33
问题 I'm trying to create documents massively using information from a spreadsheet to Google using Google Apps Script, but I don't know how to use the Table class (specifically the method: RemoveRow) I created an example (less complex) in order to illustrate my problem. I have a Google document called "Sales Reports", this document read information from this Google Sheets called Data. So far no problem, I can do it. However, there are a condition. The product A and product B are exclusive, that is

How to import multiple csv files (of identical format) and create charts automatically in a Google Spreadsheet?

妖精的绣舞 提交于 2019-12-10 10:03:15
问题 I have about 25 csv files, all of the same format (identical number of rows and columns). I would like to import these into separate sheets (tabs) of a google docs spreadsheet, and create charts (about 10) in each of the sheets. Is there a convenient script or some automatic way of populating the spreadsheet, given the format and chart templates for one sheet? One solution is to (a) import one csv file into a sheet, (b) create all the charts in the sheet, (c) make several copies of the sheet,

Use Google Apps Script to apply heading style to all instances of a word

我是研究僧i 提交于 2019-12-09 18:52:59
问题 I am using Google App Scripts in a Google Doc, how do you write a function to find all instances of a word and apply a heading style to it: For example, I want every instance of "Dogs"... Cats Dogs Fish and style "dogs" with "Heading 2" so it looks like: Cats Dogs Fish Using Find in App Scripts on Sheets is everywhere online, but there are not many examples of using App Scripts in Docs. Sheets does not have the option to reformat text as Headings, so there are no examples of it. 回答1: The

Force iFrame links (in embedded Google Doc) to open in new window

*爱你&永不变心* 提交于 2019-12-09 09:25:47
问题 Very oddly, there seems to be no way of setting Google Document links to open in a new window. (target="_blank"). When publishing a Google Doc and using the embed functionality, an iframe snippet is generated: <iframe src="https://docs.google.com/document/pub?id=1mfSz_3cWh6eW-X3EhQTtCoZ33Km131An8Kyvmuxi5oM&embedded=true"></iframe> All links in the document will be opened within the iFrame and redirected via google's redirect service: http://www.google.com/url?q= Is there any way I can make

How to Cut, Copy and Paste from JavaScript to a User's Clipboard

旧巷老猫 提交于 2019-12-09 03:38:42
问题 There are multiple similar questions in stackoverflow which deal with how to Cut, Copy, and Paste from JavaScript (in response to a button press, for instance) without the user having to use CTRL+X, C, or V. All these answers suggest either that you are insane for wanting to do this and that users should never have their clipboards violated in such a profane manner, or to use the hack of an invisible Flash movie (which has questionable support). However, Google Docs does this, and does not

Embed Google Docs PDF viewer in IFRAME

空扰寡人 提交于 2019-12-09 00:54:45
问题 When I upload PDF to Google Docs (using Python's gdata library), I get link to the document: >>> e.GetAlternateLink().href Out[14]: 'http://docs.google.com/a/my.dom.ain/fileview id=<veery-long-doc-id>&hl=en' Unfortunately using that link in IFRAME is not working for me because PDF viewer is redirecting to itself, breaking out of IFRAME. Looking for the solution, I've found this: http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html - which looks very nice, but I can

Google script that find text in my gmail and adds it to a spreadsheet? [closed]

喜夏-厌秋 提交于 2019-12-08 13:28:45
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I'm looking for a script that will search the body text of emails from a specific sender, find a string of text in the email, such as "You'll receive: US$7.16", then take the number 7.16 and add it to a Google Doc spreadsheet where it would be broken down showing the total for the

Create (draw) barcode image from array in google doc using google script

∥☆過路亽.° 提交于 2019-12-08 13:17:28
问题 I need to generate and paste barcode image in a google doc. I've found out how to create a js array, which represents it, using google script. But have no idea how to create and paste an image from this array into google doc. Although it's easy to create an SVG image in a simple web page. Can you please help me? 回答1: If you can get something like a jQuery pluggin to work with the new iFrame HTML service, then you could create the bar code in HTML, then save the image to an image file. Then