var BAR_ID = 'PROGRESS_BAR_ID'; var BAR_HEIGHT = 10; // px var presentation = SlidesApp.getActivePresentation(); function createBars() { var slides = presentation.getSlides(); deleteBars(); for (var i = 0; i < slides.length; ++i) { var ratioComplete = (i / (slides.length - 1)); var x = 0; var y = presentation.getPageHeight() - BAR_HEIGHT; var barWidth = presentation.getPageWidth() * ratioComplete; if (barWidth > 0) { var bar = slides[i].insertShape(SlidesApp.ShapeType.RECTANGLE, x, y, barWidth, BAR_HEIGHT); bar.getBorder().setTransparent(); bar.setLinkUrl(BAR_ID); } } }
function onMessage(e) { var bot = e.message.annotations[0].userMention.user.displayName; var loc = encodeURI(e.message.text.substring(bot.length+2)); var mapClick = { "openLink": { "url": "https://google.com/maps/search/?api=1&query=" + loc } }; return { // see JSON payload in the documentation link above }; }
var slide = presentation.appendSlide(SlidesApp.PredefinedLayout.BLANK); var image = slide.insertImage(link);
GET https://www.googleapis.com/admin/reports/v1/activity/users/userKey
GET https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/drive
Person contactToCreate = new Person(); List names = new ArrayList<>(); names.add(new Name().setGivenName("John").setFamilyName("Doe")); contactToCreate.setNames(names); Person createdContact = peopleService.people().createContact(contactToCreate).execute();
String resourceName = "people/c12345"; // existing contact resource name Person contactToUpdate = peopleService.people().get(resourceName) .setPersonFields("names,emailAddresses") .execute(); List emailAddresses = new ArrayList<>(); emailAddresses.add(new EmailAddress().setValue("john.doe@gmail.com")); contactToUpdate.setEmailAddresses(emailAddresses); Person updatedContact = peopleService.people().updateContact(contactToUpdate) .setUpdatePersonFields("emailAddresses") .execute();
var TIMEZONE = "America/Los_Angeles"; var EVENT = { "start": {"dateTime": "2017-07-01T19:00:00", "timeZone": TIMEZONE}, "end": {"dateTime": "2017-07-01T22:00:00", "timeZone": TIMEZONE}, "recurrence": ["RRULE:FREQ=MONTHLY;INTERVAL=2;UNTIL=20171231"] };
GCAL.events().patch(calendarId='primary', eventId=EVENT_ID, sendNotifications=True, body=EVENT).execute()
{ "repeatCell": { "range": { "endRowIndex": 1 }, "cell": { "userEnteredFormat": { "textFormat": { "bold": true } } }, "fields": "userEnteredFormat/textFormat/bold", } }
"fields": "userEnteredFormat/textFormat(bold,italic)"
function getIndexesOfFilteredRows(ssId, sheetId) { var hiddenRows = []; // limit what's returned from the API var fields = "sheets(data(rowMetadata(hiddenByFilter)),properties/sheetId)"; var sheets = Sheets.Spreadsheets.get(ssId, {fields: fields}).sheets; for (var i = 0; i < sheets.length; i++) { if (sheets[i].properties.sheetId == sheetId) { var data = sheets[i].data; var rows = data[0].rowMetadata; for (var j = 0; j < rows.length; j++) { if (rows[j].hiddenByFilter) hiddenRows.push(j); } } } return hiddenRows; }
function setSheetBasicFilter(ssId, BasicFilterSettings) { //requests is an array of batchrequests, here we only use setBasicFilter var requests = [ { "setBasicFilter": { "filter": BasicFilterSettings } } ]; Sheets.Spreadsheets.batchUpdate({'requests': requests}, ssId); }
addresses = GMAIL.users().settings().sendAs().list( userId='me' ).execute().get('sendAs')
{ "sendAs": [{ "sendAsEmail": string, "displayName": string, "replyToAddress": string, "signature": string, "isPrimary": boolean, "isDefault": boolean, "treatAsAlias": boolean, "smtpMsa": { "host": string, "port": integer, "username": string, "password": string, "securityMode": string }, "verificationStatus": string }, ...] }
addresses = GMAIL.users().settings().sendAs().list( userId='me', fields='sendAs(sendAsEmail,isPrimary)' ).execute().get('sendAs')
insertText
batchUpdate()
objectID
{ "insertText": { "objectId": objectID, "text": "Hello World!\n" }
{ "createShape": { "shapeType": "SMILEY_FACE", "elementProperties": { "pageObjectId": slideID, "size": { "height": { "magnitude": 3000000, "unit": "EMU" }, "width": { "magnitude": 3000000, "unit": "EMU" } }, "transform": { "unit": "EMU", "scaleX": 1.3449, "scaleY": 1.3031, "translateX": 4671925, "translateY": 450150 } } } }
requests
SLIDES
deckID)
SLIDES.presentations().batchUpdate(presentationId=deckID, body=requests).execute()