google-docs-api

How to update DocsList to DriveApp in my code

纵然是瞬间 提交于 2019-12-17 05:11:28
问题 My script that generates a pdf document from a template within Google Drive and emails it to a recipient based on columns in a spreadsheet stopped working today due to the depreciation of DocsList. See here: https://developers.google.com/google-apps/documents-list/ I have tried updating following this guide https://developers.google.com/drive/web/migration to update all instances of DocsList with DriveApp, but I cannot get it to work. Could somebody please help me update this script to work

Creating anchored comments programmatically in Google Docs

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 04:31:13
问题 I have been unable to programmatically create a comment that is anchored to specific text in a Google Doc using an app script with the document. Google documentation about how to create an anchored comment using the Google Drive API: https://developers.google.com/drive/web/manage-comments Here is the code I have to create the comment in the doc: Drive.Comments.insert({ "kind": "drive#comment", "author": { "kind": "drive#user", "displayName": USER_EMAIL, "isAuthenticatedUser": true, },

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,

Google documents. I need to edit a document with public link c#

元气小坏坏 提交于 2019-12-13 03:07:08
问题 Google documents. I need edit a document with puplic link in c#. Is there anyway? FileStream fs = FileStream("C:\*****.jpg", FileMode.Open); DocumentEntry entry2 = service.Update(new Uri(strAlternateUriComesFromServer), fs, "text/plain", null) as DocumentEntry; This code giving error. How can i edit public document. i got only shared document link and i need to update it. 回答1: If you know the document name or resourceID, and that document is shared with you, and you have the proper read/write

Change Header Margin with Google Docs API

柔情痞子 提交于 2019-12-13 02:55:18
问题 I want to add an image to the Header of a Google Document that will occupy the whole space inside the header (without any empty white spaces on either side of the image). By default, there is indentation/margin on 3 sides of the header (top, left and right). I have successfully removed left and right margin/indentation by setting indentStart , indentFirstLine and indentEnd to 0 . Unfortunately, I cannot remove the blank space on the top of the header! For reference: If you want to adjust the

Is it possible to covert Word docs to a Google Doc?

℡╲_俬逩灬. 提交于 2019-12-13 01:26:52
问题 I am uploading Word documents to Google Drive using the Google SDK. I can view these files once uploaded through the Google Drive interface, but to edit these documents I need to selected "Open with Google Docs". When I do this, Google makes another version of the file and saves it to my Google Drive. I want to automatically create a URL for users to click on once their file has been uploaded, so I presume I somehow need to convert the uploaded file (Word Document) to a Google Docs file so a

Replace image with table in google doc

寵の児 提交于 2019-12-13 00:54:44
问题 I want to replace a selected image with a table containing that image in a Google Doc. No table is inserted into the google doc when I run the code. function insertImage(ID, caption) { var selection = DocumentApp.getActiveDocument().getSelection(); if (selection) { var elements = selection.getSelectedElements(); var tImg = elements[0].getElement(); var cells = [ [tImg.asInlineImage(), ID+': '+caption] ]; var parentElement = tImg.getParent(); parentElement.insertTable(parentElement

Google Drive SDK docid changed - How to relate documents stored by old docid to the new one?

谁说胖子不能爱 提交于 2019-12-13 00:13:59
问题 It appear that the docid's changed for all google drive documents on our google apps domain... Will it change again? Why was it changed? (my google/yahoo/bing searches on this subject turn up nothing useful - is no one else experiencing this? For me it seems to have happened at around Jan 16/17th) And most importantly for now: Is there a way to cross-reference all of the old docid's to the corresponding new docid's? 回答1: Found out some more info. The root cause is a migration from the old

Fail to upload a image file into Google Doc via java api

故事扮演 提交于 2019-12-13 00:11:53
问题 below is my code DocsService client = new DocsService("testappv1"); client.setUserCredentials(username, password); client.setProtocolVersion(DocsService.Versions.V2); File file = new File("C:/test.jpg"); DocumentEntry newDocument = new DocumentEntry(); newDocument.setTitle(new PlainTextConstruct("test")); String mimeType = DocumentListEntry.MediaType.fromFileName(file.getName()).getMimeType(); newDocument.setMediaSource(new MediaFileSource(file, mimeType)); newDocument = client.insert

Insert table in Google Docs API Python

北城余情 提交于 2019-12-12 21:26:10
问题 From Working with tables | Google Docs API | Google Developers requests = [{'insertTable': {"table": { "columns": 2, "rows": 2, "tableRows": [ { "tableCells": [ { "content": [ { "paragraph": { ... }, } ], }, { "content": [ { "paragraph": { ... }, } ], } ], }, { "tableCells": [ { "content": [ { "paragraph": { ... }, } ], }, { "content": [ { "paragraph": { ... }, } ], } ], } ]}}}] result = service.documents().batchUpdate(documentId=DOCUMENT_ID, body={'requests': requests}).execute() I'm getting