google-docs-api

Google Script: How to highlight a group of words?

人盡茶涼 提交于 2019-12-06 07:25:32
I'd like to write a script for google docs to automatically highlight a set of words. For one word I could use a script like this: function myFunction() { var doc = DocumentApp.openById('ID'); var textToHighlight = "TEST" var highlightStyle = {}; highlightStyle[DocumentApp.Attribute.FOREGROUND_COLOR] = '#FF0000'; var paras = doc.getParagraphs(); var textLocation = {}; var i; for (i=0; i<paras.length; ++i) { textLocation = paras[i].findText(textToHighlight); if (textLocation != null && textLocation.getStartOffset() != -1) { textLocation.getElement().setAttributes(textLocation.getStartOffset()

How to determine if the account is a Google apps account?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 04:11:46
I am using the Google documents list api for .net V3(dll version 2.0.1.0). I am using client login authentication as described in this link https://developers.google.com/google-apps/documents-list/#authorizing_requests_with_clientlogin How can i determine if its a Google apps account or a normal Google account? Thanks, Bharath Google consumer accounts are @gmail.com or rarely @googlemail.com , the rest will be Google Apps accounts. If your goal is to check whether an user has access to a given functionality you can send a request to the Metadata feed and check the <docs:feature> elements. For

Google Docs/Drive API does not permit a new document to be inserted into a new Google account

我的梦境 提交于 2019-12-06 02:18:35
We have identified an issue with the Google Docs/Drive APIs that is consistently reproducible, and appears to be a new bug introduced a few weeks ago. To see the issue, follow these steps: Create a brand new Google account, but do NOT do anything in that account (do not click on Drive to view Google Drive) -- just create it and close that window. Attempt to insert a new (empty) document via the Google Docs API (we use Zend GData for that) or the new Google Drive API. Result: With old Google Docs API, the error " Expected response code 200, got 400. Unable to convert document " is thrown (which

edit google document remotely

与世无争的帅哥 提交于 2019-12-05 20:55:10
I'm trying to add a feature to my website as follows: Clicking a button appends text to a Google document. Obviously I will need to create an Apps Script in the drive. The question is how to trigger the Apps Script from my website. You can assume that I am the owner of the drive/document and so have permissions to edit it in any way I like. I have looked at these topics: Workarounds : How to edit native google documents programatcally?item How to programmatically manipulate native google doc files It seems they are all actions performed from the drive itself and not triggered remotely. I have

How to get Google docs last edit date

别等时光非礼了梦想. 提交于 2019-12-05 17:23:22
问题 I am working on an app in which I need to show the date when google doc was last edited. Snapshot Here I am able to get last modified date through Drive api But it is different from last edited date for cases when file's metadata (e.g. permission) has changed and content hasn't. Is there any way to get date when google doc was last edited? 回答1: In Google Apps Script there is a DriveApp service that you can use. Something like this will work: function lastUpdatedOn() { var FILE_ID = 'FILEID';

Programmatically edit a Google doc with JavaScript

我的梦境 提交于 2019-12-05 10:35:07
What I'm trying to do is run some JavaScript code that will enter text into a Google doc. What I have done so far is create an iframe element on my personal web page that embeds Google Docs. What I want to do, for now, is use functions from Google's source code to input the text. When I use the Chrome inspector along with a js beautifier, I found that if I listen for a keypress event, I get brought to the following code segment: function dKa() { var a = eKa, b = TJa ? function(c) { return a.call(b.src, b.key, c) } : function(c) { c = a.call(b.src, b.key, c); if (!c) return c }; return b } I

Reading Google docs spreadsheet

冷暖自知 提交于 2019-12-05 01:41:53
问题 Is it possible to pull rows from a Google Docs spreadsheet using PHP? In SQL I would use something like: SELECT * FROM table WHERE field = 'value' LIMIT 1 Is there a way to do this? I've heard you are supposed to use a 'Zend' framework, but I haven't been able to figure that out either. Any help would be appreciated 回答1: From the Zend_Gdata documentation: <?php $query = new Zend_Gdata_Spreadsheets_ListQuery(); $query->setSpreadsheetKey($spreadsheetKey); $query->setWorksheetId($worksheetId);

Google docs viewer url parameters

限于喜欢 提交于 2019-12-05 00:40:59
Is there any sort of documentation on exactly what parameters you can put in the url of Google viewer? Originally, I thought it was just url,embedded,chrome, but I've recently come accross other funny ones like a,pagenumber, and a few others for authentication etc. Any clues? One I know is "chrome" If you've got https://docs.google.com/viewer?........;chrome=true then you see a fairly heavy UI version of that doc, however with "chrome=false" you get a compact version. But indeed, I'd like a complete list myself! You can pass q=whatever to pass a search query to the viewer. I'm also on a quest

Ovewrite table Google Script interactive Google Sheet to Google Docs and vice-versa

≯℡__Kan透↙ 提交于 2019-12-04 22:17:35
This is my final project in view mode : https://drive.google.com/open?id=1gOOb3hND3q2v0vTy8SfPVHFiCnTkJPR5 each row corresponds to a Google Doc project so when I modify in the row it will modify the corresponding Doc and when I click to see the document in the same window when I modify if then click the submit button I will change the row so I have an interactivity 100% with only the trigger onEdit(e) which will call function Edit(e) and openDialog(e). The problem is that it can overwrite the Google Doc file as in the image. The problem comes from function onEdit(e){ Edit(e); openDialog(e); //

How to upload documents with new python-gdata (2.0.16)?

这一生的挚爱 提交于 2019-12-04 19:23:48
With python-gdata 2.0.14, I used the following pieces of code to create and upload documents: # To create a document import gdata.docs import gdata.docs.client from gdata.data import MediaSource gdClient = gdata.docs.client.DocsClient(source="my-app") gdClient.ssl = True gdClient.ClientLogin("login", "pa$$word", gdClient.source) ms = MediaSource(file_path="temp.html", content_type="text/html") entry = gdClient.Upload(ms, "document title") print "uploaded, url is", entry.GetAlternateLink().href and # To update a document entry.title.text = "updated title" entry = gdClient.Update(entry, media