google-docs

Change a document's permissions via Google Apps Script

倾然丶 夕夏残阳落幕 提交于 2019-12-13 19:20:11
问题 I'm looking for sample script that resets the default permissions on an external spreadsheet based on the email address and DocumentID passed to the script. I intent to create a script that can parse information from an email message to acquire the DocumentID and email, execute the permission change from default to anyone with a link , then email the passed address with that link. It appears that perms are controlled by the DocList API and I'm not finding samples of GAS interacting with that

Why does Google Docs Conditional Formatting with custom formula not work?

℡╲_俬逩灬. 提交于 2019-12-13 16:17:52
问题 I am attempting to conditionally format a column of numbers to highlight those that are equal to the maximum. For example, if the column has these values 3,5,8,4,8,2,8,7 I want the 8s (in the 3rd, 5th and 7th rows) to be formatted. I am selecting the row, right-clicking to choose "Conditional Formatting", selecting "is equal to" from the "Format cell is..." dropdown, and typing in "=MAX(A1:A8)" for the custom formula. The cells that equal the max (8) have the conditional formatting correctly

Updating a document in Google Docs using the API?

送分小仙女□ 提交于 2019-12-13 15:27:08
问题 I want to update the contents of the already uploaded Google Doc file. I'm using the below code: DocumentsService service = new DocumentsService("app-v1"); string auth = gLogin2(); service.SetAuthenticationToken(auth); Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes( "CONTENTS PLEASE CHANGE")); DocumentEntry entry = service.Update(new Uri("feedURL"), stream, "text/plain", "nameOfDoc") as DocumentEntry; For "feedURL" I tried using all the possible links: alternate, self, edit,

Export Google Doc **with** suggested changes to plain text

混江龙づ霸主 提交于 2019-12-13 11:06:32
问题 My research team uses "suggesting mode" in Google Doc to flag changes made to papers that we jointly write (in latex format/syntax). When I export the paper to "plain text", the text unfortunately ends up containing the original verbiage rather than the most recent version of suggested changes . I need the same capability in Google Docs as MS Word provides, which is the "tracked changes" (suggesting mode edits) being exported into the text file without first having to click the "accept"

How we can create the folder in google drive by using java

痞子三分冷 提交于 2019-12-13 08:48:22
问题 I need to create the folder in Google drive by using Java. Does any one tell me the example or how to create the folder in Google drive. Thanks in advance...!!! My program package net.sf.dynamicreports.examples; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import com.google.gson.JsonObject; public class SourceCodeProgram { public static void main(String argv[]) throws Exception {

Find if a Google Document is blank using google script

北战南征 提交于 2019-12-13 08:40:01
问题 How to find if a google document is blank using App script? I tried this function myFunction() { var body = DocumentApp.getActiveDocument().getBody(); var para = body.getParagraphs(); var count = 0; for (i = 0; i < para.length; i++) { if (para[i].getText() != "") count++; } if(count=0) Logger.log("Empty"); else Logger.log("NOT EMPTY") } I am sure that this works good only if the document has text content alone. I am eager to know if there is any way to find if the document is blank. 回答1: A

Retrieve only specific columns of spreadsheet with zend gdata from gdocs

喜夏-厌秋 提交于 2019-12-13 06:06:25
问题 I am working with relatively large spreadsheets from gdocs and access them via the zend library. I only need certain columns at any given time so in order to save memory it would be helpful to use the list-based feed to only retrieve these certain columns and not the whole spreadsheet. The basic query I am using is according to the zend documentation $query = new Zend_Gdata_Spreadsheets_ListQuery(); $query->setSpreadsheetKey($spreadsheetKey); $query->setWorksheetId($worksheetId); $listFeed =

How to determine the named range from position in Google Docs through Google Apps Script

流过昼夜 提交于 2019-12-13 05:49:32
问题 I am looking at a way to determine the named range in Google docs through Google Apps Script for the current cursor position. Is there anyway to do that? Context: I am marking a range in the google document for review using named range. I would like to get the named range if the cursor is placed in that location of the document so that I can show that there is a review item on that area. Could you please let me know if there is a way to do that in Google Apps Script? thanks Jasper 回答1: var

Google Apps Document onOpen not working

纵饮孤独 提交于 2019-12-13 04:57:23
问题 I am attempting to create a google document that autofills author, document name, date created and date modified as per a Word doc. I have a script that is functioning when I run in the script editor and when I trigger via an added menu item but will not trigger onOpen. This is how I am accessing the info: var document = DocumentApp.getActiveDocument(); var body = DocumentApp.getActiveDocument().getBody(); var bodyText = body.editAsText(); var docID = document.getId(); var docName = document

Union function - Passing argument in custom function - Google-spreadsheet

空扰寡人 提交于 2019-12-13 03:37:56
问题 While trying to answer this question, I found a strange behavior. Here's my code : function remove(val, array){ var res = new Array(); for(var i=0; i<array.length; i++){ if(array[i] != val){ res.push(array[i]); } } return res; } //we assume that there is no duplicates values inside array1 and array2 function my_union(array1, array2){ var longuer; var shorter; var arrayRes = new Array(); if(array1.length < array2.length){ longuer = array2; shorter = array1; } else { longuer = array1; shorter =