AppsScriptPulse

Pen-based Interaction with Google Sheets in Mobile Virtual Reality

I’m sure for many pro Google Sheets users when you look at a Google Sheet what you see on screen is different for what you ‘see’ in your mind. Researchers from Coburg University, Microsoft Research and the University of Cambridge have potentially bridged this gap showing what Google Sheets can look like virtual reality (VR).

Whilst the video embedded above is not explicitly about Google Apps Script, I think it’s always worth keeping an eye on the horizon to see what the future might bring (you might want to skip through to 05:12 to see what I mean). You can also read the full research paper, in which the researchers explain how they used the Google Sheets API to build the experimental interface in the Unity game engine.

For Google Apps Script developers I’m sure you’ll be able to see how this solution could also benefited from the built-in SpreadsheetApp methods like getCurrentCell() and activate(), rather than using the the Sheet API, which reported as a limitation that haas reported in the research paper:

Since the Google Sheets API exposes no functionality to track client-side interactions, operations of users with the web page were tracked inside Unity. In particular, tracking of cell selection was implemented by constructing virtual-cells in the Unity space using oriented bounding boxes, and spatially position them in their corresponding places to fit the spreadsheet texture. Tracking of the pen and the Unity collision detection mechanism is used to detect whether the pen tip lies inside a certain cell.

Gesslein et al. (2020)

How to build a Google Analytics Dashboard with Apps Script and Google Sites – Sheets to Apps

Using Google Analytics and looking for a new way to aggregate, store, and efficiently organize the data from your website in a Google Sheet? In this episode of Sheets to Apps, we show you how to combine the Google Analytics add-on with Apps Script, resulting in the automation of cohesive data summaries that are compatible with Google Sites.

In this latest episode Alexandrina Garcia-Verdin demonstrates how the Google Analytics Add-on can be combined with macros to automate regular reporting. The video description has links to all the resources you need to set this up.

Whilst ‘Sheets to Apps’ videos are targeted at low/no coders as an Apps Script Developer I always find it useful to have a look at the code to see how it is done, as more often than not there will be a technique or method I’ve not come across. In the case of this example my new discovery was the .autoFill() and after browsing the documentation, .autoFillToNeighbor() methods in SpreadsheetApp. These methods allow you to replicate the auto-fill functionality users have in Google Sheets.

Another discovery was the various .setOption() calls when building the charts. I’ve used .setOption() in projects in the past and the issue I’ve had is navigating the long list of options you can use for various chart types. Using the macro recorder seems like a great way to capture all the options you want to add to your script project.

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

Introducing Zapier’s new Gmail add-on

Image: Zapier

Image: Zapier

This add-on makes it easy to move high-value emails into your other apps with just a click, without ever leaving Gmail.

You can use the add-on to create customized one-click workflows that give you seamless productivity—by moving important messages out of a private inbox and into a shared tool like Slack, for example, or by routing emails to apps like Asana to streamline your project management.

Following on from our recent repost of Zapier’s Google Sheets app of the day, Zapier are continuing their love of Google Apps Script with a new Gmail Add-on. The source code for this add-on is proprietary but again useful to see firms investing in G Suite solutions for the marketplace.

Source: Introducing Zapier’s new Gmail add-on – Updates | Zapier

QUnit2GS is a Google Apps Script Library that allows Apps Script projects to be tested using QUnit

QUnit2GS is a Google Apps Script Library that allows Apps Script projects to be tested using the QUnit JavaScript testing framework – qunitjs.com. Just add this library to your project and start writing tests in just a few minutes.

Created by Andrew Roberts and Alejo Grigera Sutro this library will make it easier to adopt test-driven development with your Google Apps Script projects. The site is worth an explore to see what is possible…

Source: Home | QUnitGS2

How To Create An Android App That Posts Pictures to Google Sheets with Google Apps Script

I used the MIT App Inventor site to create an Android app that…
  • Uses the camera to take a picture and saves it to the device’s gallery
  • Let’s you select a picture from the gallery
  • The image is converted into base64 and uploaded to a web app
  • Additionally, it also sends rotation and lat/lng coordinates and lets you add a textual comment as well.
This Android app sends it to an Apps Script web application inside a Google Spreadsheet

Nice fun project from Tom Smith that use MIT App Inventor to create an Android app that is able to send data to a Google Sheet. Check out the source link for all the code you need.

Source: How To Create An Android App That Posts Pictures To Google Sheets

Google Sheets: Zapier app of the day

Need your spreadsheet to do a specialized task, such as detecting and deleting duplicate rows automatically? You can build and publish custom add-ons with the Google Apps Script to take your spreadsheets to the next level. Don’t know code? Browse the Google Sheets add-on store to see what features others have built.

Always nice to see other organisations highlight Google Apps Script.

Source: Google Sheets: Zapier app of the day

Build A Lookup Table Generator For Google Tag Manager with Google Sheets and Apps Script

The purpose of the Lookup Table generator is to automate the often tedious task of adding many, many rows to a Lookup Table within the Google Tag Manager UI. There are other solutions for this, but none (as far as I know) that uses the Google Tag Manager API.

Within the Google Apps Script community there is a strong representation from those working in analytics and SEO. Simo Ahava has shared a comprehensive tutorial which shows how you can interact with the Google Tag Manager API in Google Sheets. Click through to the source for more details and all the code you need.

Source: Build A Lookup Table Generator For Google Tag Manager | Simo Ahava’s blog

Send Tweets from Google Sheets using a Google Apps Script

In this post, you will learn how to send automated tweets from Google Sheets to Twitter using Google Apps Script.

This post includes everything you need to get started sending tweets for Google Sheets. This tutorial uses the community contributed Twitterlib library from Bradley Momberger, which has some implemented methods for sending and fetching tweets.

Source: Send Tweets from Google Sheets using a Google Apps Script

Control responses in Google Forms in 4 lines of Google Apps Script

If you are using Google Forms to handle sign-ups for an upcoming event, and you want to control the number of responses (Limit responses), guess what! you can do it using Google apps script (only in 4 Lines of Code)

Nice little snippet highlighted by Aya Sayed, click through to the source for the code snippet.

Source: Control responses in Google Forms! | by Aya Sayed | Jul, 2020 | Medium

Sync RingCentral Call Log into Google Sheets with Google Apps Script | by Embbnux Ji | RingCentral Developers | Medium

In this article, I would like to show you to how to create a Google Sheets add-on to help people sync RingCentral call log into spreadsheets.

Nice post highlighting how you can integrate the RingCentral service into a Sheets Add-on. The post includes more general information about setting up access to the RingCentral API which might be useful in your other projects.

Source: Sync RingCentral Call Log into Google Sheets with Google Apps Script | by Embbnux Ji | RingCentral Developers | Medium

First look at the new Google Apps Script Integrated Development Environment (IDE) Script Editor – MASHe

As part of Next OnAir week 2 the focus was on ‘Productivity and Collaboration’ Charles Maxson from the G Suite DevRel team not only provided some highlights from the week, but he also premiered the new Google Apps Script IDE.

This post includes a recording to a live demo of the new Google Apps Script editor. No news on when the new Script Editor will be generally available, but from the demo it looks like Google have focused on making it easier for developers to code and debug scripts.

Source: First look at the new Google Apps Script Integrated Development Environment (IDE) Script Editor – MASHe

Goa v8 changes and enhancements for OAuth2 and Google Apps Script

Goa tutorial

v8 and other htmlservice changes meant I had to make a few small changes to cGoa. The good news it’s easier to use than ever, and supports a few new services too. It’s best to look at the service list on github, as that’ll be kept up to date. Here’s a reminder of how to use it.

There are a couple of OAuth 2 Google Apps Script libraries out there but cGoa from Bruce Mcpherson is the easiest one I used, particularly, when it comes to setup. Bruce’s post has more details including various ways you can use the library.

Source: Goa v8 changes and enhancements

Converting SVG Format to PNG Format using Google Apps Script · tanaike

This is a sample script for converting the SVG image data to PNG image data using Google Apps Script. Unfortunately, in the current stage, there are no methods for directly converting the SVG to PNG in Google Drive service. But it can be achieved by Drive API

Nice trick to get .svg files stored in Google Drive in a raster format.

Source: Converting SVG Format to PNG Format using Google Apps Script · tanaike

Google Apps Script – Stack Overflow growth trends and predictions 

Stack Overflow in 2023: Predicting with ARIMA and BigQuery – Can you predict the top Stack Overflow tags of 2023? BigQuery makes this easy, with its new support for training time-series analysis models with ARIMA.

Felipe Hoffa has prepared an interesting post looking at current Stack Overflow tag usage and future trends. You can read more details about the trends for the big hitters like Python and JavaScript in the source blogpost. Felipe’s post also gives you the opportunity for a little ‘exploratory analyses’ as he has also provided a link for you to play with an interactive dashboard on Data Studio.

Felipe mentioned in a tweet that  the prediction was Google Apps Script was to continue to grow:

Given this I decided to have a look at the google-apps-script tag and a couple around it in the Data Studio dashboard and came up with this:

Stack Overflow tag trends: Historic + predictions

Stack Overflow tag trends: Historic + predictions
By @felipehoffa
Read more: bit.ly/arima_so

So Google Apps Script, continuing to grow, currently more viewed than Google Cloud Platform and on a par with FFmpeg ;)

Source: Stack Overflow in 2023: Predicting with ARIMA and BigQuery

Google Sheets Sidebar with Materialize CSS & jQuery – Andrew Roberts

Materialize

Tutorial on creating a Google Spreadsheet Sidebar with Materialize CSS framework, jQuery JavaScript framework, and Google Apps Script.

Andrew Roberts has shared a tutorial and boilerplate for using the Materialize CSS framework in the Google Sheets sidebar. Materialize is based on Material Design and the framework is lightweight and easy to use. This framework will also work for other G Suite editor sidebars (Docs, Sheets, Forms, Slides). If you plan to use Materialize in your Editor Add-on Google ask that the design adheres to the UI style guide.

Source: GSheet Sidebar with Materialize CSS & jQuery – Andrew Roberts

Google Apps Script: Extract Specific Data From a PDF and insert it into a Google Sheet – Yagisanatode

Have you ever asked for a list from a client, another department or agency and instead of saving into a file that might even be considered marginally useful, they give it to you as a pdf. … Continue reading “Google Apps Script: Extract Specific Data From a PDF and insert it into a Google Sheet”

Yagi shares a comprehensive walk-through of how you can sometimes extract data from .PDF documents using Google Apps Script and the advance Drive service. The solution is also able to work on .PDFs created from images using the built-in OCR features of Google Drive and you might want to drop the getTextFromPDF() function shared in the post.

Source: Google Apps Script: Extract Specific Data From a PDF and insert it into a Google Sheet – Yagisanatode

How macros can be used to build Apps Scripts for cleaning data – Sheets to Apps

Cleaning up data from downloaded accounting reports or from other systems can take up valuable time and resources. In this episode of Sheets to Apps, we’ll walk you through adding automation to your monthly Excel accounting data that records your steps into a script that you can run repeatedly with Google Sheets macro recorder.

From the video description you’ll find all the links you need to the example Google Sheet, instructions and more

Calculating moving averages in Google Sheets with Google Apps Script (and tips on writing custom functions)

Por esa razón me he puesto manos a la obra y he preparado MEDIAMOVIL(), una función personalizada GAS capaz de calcular varios tipos de medias móviles, que puede ser utilizada (como todas las funciones personalizadas) de manera combinada con el resto de funciones integradas que nos ofrecen las hojas de cálculo de Google.

TRANSLATED: For this reason I have gotten to work and have prepared MEDIAMOVIL(), a custom GAS function capable of calculating various types of moving averages, which can be used (like all custom functions) in combination with the rest of the integrated functions. offered by Google spreadsheets.

Great post from Pablo Felip (@pfelipm) on calculating moving averages in Google Sheets. As part of this Pablo has developed and shared the MEDIAMOVIL() custom function he has developed in Google Apps Script. Clicking through to the source code on Github Pablo has also shared lots of advice on developing custom functions for Google Sheets including using the contextual help features available in custom functions as well as handling parameters and throwing appropriate error messages to the user.

Source: Calculando medias móviles con Google Apps Script

Subscribe to Apps Script Pulse...