This is a sample script for clearing the discrete cell values on multiple sheets using Google Apps Script.
Handy little code pattern for clearing ranges across multiple tabs in Google Sheets. Snippets are provided for both SpreadsheetApp and the advanced Sheets service.
When working in a team and/or with a client, you want to have multiple environments. At minimum, you probably want a dev environment (or multiple ones) in which you are working, and a test environment in which the client or your team can run acceptance tests before production. Of course, they must both be separate from the production environment. To push your code to the correct environment, you need to either update the .clasp.json file manually or keep multiple copies of your script with different .clasp.json files. Fortunately, things have just become significantly easier, as I recently built an app for this purpose called clasp-env, which is available on NPM. See the source link for details.
Convert selected range into PNG image and save it to Drive
In this post from Max Makhrov you can discover how you can convert a selected Google Sheets range to an image. With options to embed charts and tables in Google Docs and Slides you might be asking why you would want to do this. Max highlights a couple of great reasons:
You need to create a screenshot and use it later: send it to Telegram or email, or use it in Slides.
You want to create an image of cells as you see them on screen, containing images, charts, sparklines, etc.
You want to create a screenshot of a range that does not fit your screen.
You want to create a screenshot of a range with high resolution.
There are some limitations with this approach which are outlined in the post and if you have any solutions there is a link to contribute to the GitHub repo.
Learn how to track link clicks using Google Sheets and Apps Script to create a simple, lightweight tracking system
You live and learn! This is a regular occurrence if you are a subscriber to the work of Ben Collins (benlcollins.com). No exception with this recent post highlighting the ping attribute which can be used in <a> HTML links. This attribute has been around for a long time, but I’m sure many people like have never come across it. In the source post from Ben you can learn how to setup an Apps Script web app which will let you record link clicks in a Google Sheet.
A note of caution is whilst ping is valid HTML not all browsers choose to use it or enable it by default, something Mozilla have decided to do in Firefox. You can head over to Mozilla mdn documentation for the browser compatibility table and here is also an interesting post on how Google tracks with the ping-attribute.
Preview tweets and user data when sharing links, along with the ability to follow a specific user or like a particular tweet.
If you haven’t looked at Google Chat apps or not looked at Chat apps for a while this is a great post from Sourabh Choraria outlining the development process using Google Apps Script. As part of this Sourabh includes an overview and source code for a Twitter powered Chat app recently published and available to try out in your Google Workspace domain. The app showcases slash commands as well as a recent new feature of preview links.
Another useful discovery from Kanshi Tanaike this time highlighting the ability to use markdown in Google Apps Script code comments. For those unfamiliar, JSDoc is the syntax used to automatically generate inline documentation in Google Sheets custom functions,Libraries as well as function references in your script project. As highlighted in the post as well as being able to add @constructor tags, developers can use markdown syntax to provide additional formatting to documentation comments. See the source post for details of supported markdown syntax.
🏝 It’s finally summer break! We all wish we could create Out Of Office events in Calendar using Google Workspace #AppsScript (I know you do). But Calendar API is yet not allowing us to do so.
This post from Dararath BEAUVOIR is a great reminder that in Google Workspace/Apps Script development that you occasionally need to look beyond the built-in services like CalendarApp to the Advance Service equivalents. In this case Calendar.CalendarList.list is used because unlike CalendarApp using the Advanced Service the event response indicated if the eventType is out-of-office. More details are included in the source post.
Forms History is a Google Workspace Add-on that allows you to monitor your version history and store copies in Google Forms
Not just talking the talk, but also walking the walk. Shortly before taking a new role at CTS, the largest dedicated Google Cloud Partner in Europe, I published Forms History an add-on to enable revision history functionality in Google Forms.
Fellow Google Developers Expert, Scott Donald, has picked this up in the latest episode of GWAOw! his dedicated to Google Workspace Add-on review show. You can follow the source link for the YouTube clip and more. As part of the episode Scott rightly highlights the creative work of Alice Keeler, which hasn’t just included artwork but Alice has also provided a huge amount of support in promo and usability.
This is a sample script for retrieving the values of dropdown list of the smart chips on Google Document using Google Apps Script.
At August 23, 2021, 3 Classes for retrieving the smart chips have been added to Google Apps Script. But, in the current stage, unfortunately, all values of the smart chips cannot be retrieved by the Classes. For example, the dropdown list of the smart chips cannot be retrieved
Incredibly useful report and workaround from Kanshi Tanaike for Google Workspace Devs needing to get some ‘smart chips’ values from Google Docs. Hopefully classes/methods will be added to Apps Script and the Google Docs API (here is a related feature request you can star in the issue tracker), particularly as the current solution is to convert the Google Doc to .docx and then back to Google Doc.
The following Google Apps Script is designed to reposition 2 columns within a Google Sheet. It is a small and simple bit of code but it was something new to me when I was collating lots of files together and appending columns at the end – which then needed to be moved.
In this example I am moving columns ‘collegename’ (E) and ‘shoesize’ (F) to the left of ‘postcode’ (D). So that ‘postcode’ will be the final column (F).
I use Google Apps Script to support staff and students in my job. I enjoy dabbling with creating tools to help with automation and I freely share my learning experiences on my blog, where I also have a number of useful Google Add-ons: www.pbainbridge.co.uk