google-docs-api

How do I connect Android apps with Google Sheets spreadsheets?

試著忘記壹切 提交于 2019-12-29 04:01:25
问题 I'm trying to do an Android app that needs to work with Google spreadsheet API. I'm new in this, so I'm starting with the version 3 of the api: https://developers.google.com/google-apps/spreadsheets/ I followed all the steps, downloaded all the jar files to lib subfolder in my project folder and then I added to the build path in Eclipse as usual. So although there is no Java example to perform Oauth 2.0, I just tried to declare: SpreadsheetService service = new SpreadsheetService("v1"); but

How to match comments on an image using kix anchor (or not) in Google Docs

自古美人都是妖i 提交于 2019-12-28 13:57:14
问题 It's possible to retrieve elements of an open Google Docs document, starting from DocumentApp.openById(doc_id, folder_id) but the comments on a document are retrieved through the Drive API, with Comments.list Running this on a document with 2 comments: one on an image, one on a word in a paragraph shows that while text-anchored comments do, images don't return a context entry: "content": "test comment on text", "deleted": false, "status": "open", "context": { "type": "text/html", "value":

Reading CSV file into javascript string or array

元气小坏坏 提交于 2019-12-25 15:50:09
问题 I'm having a very specific problem so I hope someone can help. I'm building a map app with a CakePHP backend framework. I'm currently attempting to import some data into my application for manipulation, I have a google docs CSV file (i also have a local version) and I'm also using an custom js library. So i have a declaration that goes like so: mapbox.markers.layer().csv('csvstring'); csvstring equates to a standard string of CSV data, i looked at some examples on the mapbox website but all

Google Script document openbyid permission error

邮差的信 提交于 2019-12-25 08:13:24
问题 If in the onOpen function of a Google Doc I create a spreadsheet object by opening a spreadsheet by id, how can I pass that object to other functions if I'm using the menu system? (longer explanation below) I have a google doc script that will take a snapshot of a document at a particular time and then export that to .docx and update a spreadsheet with the url of the snapshot. This is initiated by a menu option like so: function onOpen(e) { DocumentApp.getUi().createMenu('Senate Secretary

Google App Script Page break at cursor?

£可爱£侵袭症+ 提交于 2019-12-25 05:35:11
问题 I have a button in my sidebar of which's purpose is to insert a page break where the cursor is. I tried scripting it to just insert a page break (not at the cursor but just in the body) and it works fine. However, I can't seem to get it to work at the cursor: function pageBreak() { var cursor = DocumentApp.getActiveDocument().getOffset(); insertPageBreak(cursor); } How can I accomplish this? 回答1: You need to know the element type at the cursor position. Not all element types allow a page

Replace bold to italic in google docs using apps script

ぐ巨炮叔叔 提交于 2019-12-24 13:43:19
问题 How to achieve a find and replace a bold font to italic using app script for Google docs. Note that it has to replace only the bold ones to italic and not all the text. Say. A sample text A quick brown fox jumps over a lazy dog a quick brown fox jumps over a lazy dog a quick brown fox jumps over a lazy dog. 回答1: This is slightly awkward because there is nothing like "text node in bold" in Google Documents; the Text element does not have much internal structure. The solution seems to be to

How to replace newline or soft linebreak (ctrl+enter) in Google doc app script?

寵の児 提交于 2019-12-24 10:02:00
问题 I have a working template (Google Doc) and have variables with following patterns to be replace with values {{BASIC SALARY_.Description}} {{OT1.5.Description}} {{MEL ALW.Description}} {{OST ALW.Description}} {{TRV ALW.Description}} {{ADV SAL.Description}} note: I am using soft line break (ctrl+enter) in google doc as I couldn't figure out to detect normal linebreak pattern "\n", "\n", "\r\n" but my result always weird as some line need to be replaced as proper descriptions but some need to be

Term for followup, looking for actionitems

蓝咒 提交于 2019-12-24 07:52:06
问题 I wanted to write a quick script to remind myself of follow-up action items put on the various google documents, out of google drive to benefit from the API list(). However, it seems the followup:actionitems search query is not working with the API, as the search term is not known. It returns a 400 error. For example, doing this: results = service.files().list(q="followup:actionitems", pageSize=50, pageToken=page_token, fields="nextPageToken, files(id, name)").execute() results in: Traceback

Linking a Google Slide (and Drawing) to a Google Doc using API

故事扮演 提交于 2019-12-24 07:41:24
问题 I need to add a Google Drawing to a Google Doc and I would like to know if that is possible using the API. I have been able to modify the Drawing using the Slides API (see code below) but I am not able to link this Slide to the Google Doc. function logSlidesAndElements() { var presentationId = 'id_id_id_id_id_...'; var presentation = Slides.Presentations.get(presentationId); var slides = presentation.slides; // Log the elements in the slide for (var i = 0; i < slides[0].pageElements.length; i

How to Set Horizontal Alignment On A Table In Apps Script

白昼怎懂夜的黑 提交于 2019-12-24 03:55:07
问题 I am not able to find a way to horizontally align a table in a Google Doc using Google Apps Script. I have thoroughly checked all of the documentation, and also blindly tried several approaches. Attempt One: var cells = [ ['Company', rowData[3]], ['Title', rowData[4]], ]; var tableStyle = {}; tableStyle[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.RIGHT; var mentorTable = body.appendTable(cells); var myTable = body.appendTable(cells); myTable.setAttributes