AppsScriptPulse

Plotting Points on Image using Google Apps Script · tanaike

This is a sample script for plotting the points on an image using Google Apps Script. Unfortunately, in the current stage, there are no methods for directly editing the image and putting the texts and some shapes in the methods for Google Apps Script. So in this case, it is required to use the workaround.

Clever workaround that uses Google Slides as a canvas for adding text to images.

Source: Plotting Points on Image using Google Apps Script · tanaike

Creating a book recommendation engine using Google Apps Script — Thoughts from a Technologist turned School Librarian

Don’t have time to get to all your library duties? Need more staff? Create them using code! I work in a school library and could definitely do with some help around here, so let’s write some programs to streamline a few library duties and add some “virtual staff”.

In this post, we’ll create a small tool to help get word out to the school community about book recommendations and new releases/purchases in the library. The plan is to make use of a Google Sheet to pre-populate a bunch of data as time goes on and then have a Google Apps Script pull that data periodically, display it on our digital displays using Google Slides as well as to send email updates to the community.

Nice example for creating Google Slides from Google Sheets for digital signage. The post has a useful explanation of what is going on in the code for those interested to learn more.

Source: Creating a book recommendation engine using Google Apps Script — Thoughts from a Technologist turned School Librarian

Inserting Text on Image using Google Apps Script

This is a sample script for inserting a text on an image using Google Apps Script. The flow of this sample script is as follows:

  1. Retrieve the image size using ImgApp.
  2. Create new Google Slides with the custom page size using DocsServiceApp.
  3. Put the image and text.
  4. Export the result image

Source: Inserting Text on Image using Google Apps Script

Content generation with Google Workspace Add-ons

Google Workspace Add-ons

Image credit: Google

Back when G Suite, err… Google Workspace Add-ons launched, support for Docs, Sheets, and Slides was conspicuously absent. Sure, they’ve long supported their own flavor of add-ons, but the idea of building an add-on two different ways didn’t sit well with me. Thankfully I didn’t have to wait too long for the editors to catch up. … Now that add-ons work in the editors I had the chance to build a few small demos to try them out.

Recently it was announced that Google Workspace Add-ons now support the extension of the Editors (Docs, Sheets and Slides). Steven Bazyl (Google, DevRel) has shared an overview to help you get started with Workspace Add-ons. The examples Steven shares are particularly useful if you want to start developing add-ons that work across editors as well as in Gmail. This post is particularly useful for tips on handling different host applications. Follow the link to the source for all the code and more details…

Source: Content generation with Google Workspace Add-ons

New Google Apps Script library for working with Google Docs, MS Word, Google Sheets, MS Excel and Google Slides when core/advanced service methods are not available 

This is a Google Apps Script library for supporting Document service, Docs API, Spreadsheet service, Sheets API, Slides service and Slides API. The aim of this library is to compensate the processes that they services cannot achieve.

The purpose of this contribution from Tanaike is to extend Google Apps Script to interact with certain types of Google Drive files using methods not included in the existing core or advanced services. Features worth noting are:

  • Google Docs:
    • Retrieve table width and column width from the table. The tables inserted with the default width are included.
  • Google Sheets:
    • Retrieve all images in Google Spreadsheet as an object including the cell range and image blob.
    • Retrieve all comments in Google Spreadsheet as an object including the cell range and comments.
    • Insert images in cells of Google Spreadsheet using the image blob.
    • Create new Google Spreadsheet by setting the custom header and footer.
  • Microsoft Word:
    • Retrieve table width and column width.
  • Microsoft Excel:
    • Retrieve all values and formulas of the cells.
    • Retrieve all sheet names.
    • Retrieve all images as an object including the cell range and image blob.
    • Retrieve all comments as an object including the cell range and comments.

For more details about this library visit the source on Github

Source: tanaikech/DocsServiceApp

Google Apps Script: Automated PDF Certificate Creator That Is Emailed to the Attendee – Yagisanatode

Use Google Apps Script, Google Slides and Google Sheets to quickly automate creating a Certificate of Attendance and send it to attendees.

Nice example using Google Apps Script to generate and share .pdf documents via email. The source has all the code you need to get going on this.

Source: Google Apps Script: Automated PDF Certificated Creator That Is Emailed to the Attendee – Yagisanatode

Retrieving Data from QR code on Google Slides using Google Apps Script · tanaike

This is a sample script for decoding a QR code put in Google Slides using Google Apps Script. In this case, Javascript is used at the opened dialog. And Canvas API and jsQR are used.

This is a nice example of how you can easily drop in existing JavaScript libraries into your Apps Script project by using a HTML dialog. The post also has some nice tricks for handing image data, in particular, from getDataFromQRCode() the image data is passed into the HtmlService:

const html = HtmlService.createTemplateFromFile("index");
html.image = JSON.stringify(blob.getBytes()); // adding image data
SlidesApp.getUi().showModalDialog(html.evaluate(), "sample");

This is added in client side with a printing scriptlet:

image.src = `data:image/png;base64,${btoa(String.fromCharCode(...new Uint8Array(Int8Array.of(...JSON.parse(<?= image ?>)).buffer)))}`; 

Another way you could achieve this is base64 encoding the image server side with Utilities.base64Encode().

Source: Retrieving Data from QR code on Google Slides using Google Apps Script · tanaike

Cropping Images in Google Slides using Google Apps Script

This is a sample script for cropping images in the Google Slides using Google Apps Script.

Useful snippet from Tanaike which shows how you can crop images in Google Slides by using the replace(blobSource, crop) method. The  post also highlights a limitation with the image manipulation methods available around crop centering.

Source: Cropping Images in Google Slides using Google Apps Script · tanaike

How to Download Speaker Notes in Google Slides – Digital Inspiration

With Creator Studio, you can easily convert your Google Slides presentation into animated GIFs and video slideshows. The add-on can also extract speaker notes from your slides and export them as a text file in Google Drive. Internally, the app uses Google Apps Script to export Speaker Notes from your Google presentation and writes them to a text file inside Google Drive.

In this post Amit Agarwal share some very clean code for iterating across each slide in Google Slides and export the speaker notes into a single file. Click through to the post for the source code.

Source: How to Download Speaker Notes in Google Slides – Digital Inspiration

Google Slides API — a deep dive on its powerful image manipulation methods

A post dedicated to devs and highlighting the power of the Slides API.

Use Google Apps Script and the Google Slides API to create a card game like Dobble.

Source: Google Slides API — a deep dive on its powerful image manipulation methods