AppsScriptPulse

Quickly copy or move existing files in Google Drive from a Google Sheet

Quickly copy or move existing files into folders within Google drive via a Google Sheet.

Quickly copy or move existing files into folders via a Google Sheet

Quickly copy or move existing files into folders via a Google Sheet

The following Google Apps Script tool allows you to quickly copy or move existing files into existing folders within Google/Shared drive. This is quite a niche tool so it is anticipated you would already have a Google Sheet of file IDs/URLs, though there is the option to select an existing Drive folder of files and automatically bring them into this tool.

You can continue to append further rows to the Google Sheet as existing ones will be skipped once the ‘Status’ column has automatically been marked as ‘Completed’. Alternatively you can clear the Sheet each time for a fresh start.

Source: The Gift of Script: Copy or move file into folder Tool

Google Apps Script: Mastering version control and deployment with CI/CD

Automate publication of your script from development to production easier.

This post by Stéphane Giron provides a CI/CD solution for Google Apps Script, which makes it easy for you to automate the deployment of Apps Script code from a development version to production. The solution uses the Apps Script API to manage versions and streamline the code copying process.

Stéphane has previously created a backup solution for Google Apps Script code, but it lacked version control and multi-file support. This new CI/CD solution addresses these limitations by using the Apps Script API to handle version management and the publication process.

The post includes the necessary code and configuration for implementing this solution. To use this solution you will need to enable the Apps Script API and as well as setting up your project with a standard Google Cloud Platform (GCP) Project.

As a bonus the solution also allows you the option of restoring previous versions of your deployed script, providing a rollback mechanism in case of errors or issues. This solution is lighter weight than other CI/CD setups featured in Pulse, but is easier to set up, providing a practical approach to implementing CI/CD for Google Apps Script projects and enhancing code management and deployment processes.

Source: Quick and not so dirty CI/CD solution for Google Apps Script | by Stéphane Giron | Oct, 2024 | Medium

Google Apps Script: The Secret to lightning-fast XML parsing with the Apps Script Engine (ASE)

I increased Apps Script’s performance 10x

Recently, I worked on a project with a client who needed to parse XML files and convert them to JSON. Simple enough, right? The catch? These XML files were massive — each containing hundreds or even thousands of trades. Naturally, the first thing I thought of was Google Apps Script’s built-in XMLService. It’s reliable, widely used, and integrates smoothly into Apps Script. But when I ran it on a file with 1,000 trades, the parsing took 45 seconds! That’s painfully slow for an automation process.

[Editor: In a recent blog post, Dmitry Kostyuk has shared a valuable tip for developers working with Google Apps Script. When faced with the task of parsing large XML files, he discovered that the built-in XMLService was causing significant slowdowns. For files containing thousands of records, the parsing process could take an agonizing 45 seconds.

Dmitry’s solution? Using his Apps Script Engine (ASE) and the xml-js NPM library. By making this switch, he was able to achieve a remarkable 10x increase in parsing speed, reducing the 45-second process to only 4 seconds.

If you’re working with Google Apps Script and large XML files, click the source post link to find out how you can give ASE and xml-js a try!]

Source: Make Apps Script Fast Again! With Apps Script Engine

Enhance your Google Docs skills with these Google Docs API snippets for Google Apps Script

Google Apps Script offers Document service for basic document tasks and Google Docs API for advanced control, requiring more technical expertise. This report bridges the gap with sample scripts to unlock the API’s potential.

Kanshi Tanaike’s latest blog post, “Unlocking Power: Leverage the Google Docs API Beyond Apps Script’s Document Service,” is a great read for Google Workspace developers. It offers a goldmine of code snippets that will supercharge your Google Docs projects. Tanaike highlights the advantages of using the Google Docs API for more advanced features and flexibility compared to the standard Apps Script DocumentApp Service. Even though the API requires a bit more technical know-how, Tanaike provides clear, practical examples to get you started.

Some of the sample snippets include:

  • Changing page orientation (portrait to landscape and vice versa)
  • Merging table cells
  • Creating and managing footnotes
  • Highlighting superscript numbers in footnotes
  • Resetting borders and shading
  • Creating checkbox bullets
  • Changing section margins
  • Controlling table row overflow
  • Setting custom line and paragraph spacing
  • Replacing placeholders spanning multiple paragraphs
  • Converting between soft and hard line breaks
  • Managing table borders
  • Creating nested lists
  • Retrieving all URLs from a document

Kanshi Tanaike’s post serves as a valuable resource for developers looking to expand their Google Docs capabilities. Hopefully with these sample scripts, you can start unlocking new levels of automation and customization in your Google Doc projects.

To delve deeper into the world of Google Docs API, follow the source link post.

Source: Unlocking Power: Leverage the Google Docs API Beyond Apps Script’s Document Service

Optimising Google Apps Script: Efficiently handling large datasets with iterators and generators

We’re all used to dealing with iterables such as Arrays, Maps and Sets. Creating a collection of input items, transforming then outputting is what we do all the time. However, sometimes that’s not possible – for example, where we have a potentially large input data set of unknown size that would be too big to fit in memory, or perhaps an output method with rate limits. Dealing with items 1 by 1, despite being by far the simplest to code, is often the least efficient to execute – so we use a paging method to get an input chunk at a time, and a bulk method to flush out the transformed results.

All of that can get a bit tricky, especially if you add asynchronicity into the mix.The use of iterators and generators can make coding as simple as 1 in -> 1 out, while handling chunking and bulking automagically. In this article, we’ll look at how to implement these.

In this blog post, Bruce Mcpherson explores the use of iterators and generators in JavaScript and how these can be used in Google Apps Script. A generator is a special type of function that can be paused and resumed at any point, yielding values one at a time. This is unlike regular functions that return all their results at once. Generators can be useful for handling large datasets efficiently by processing items in chunks and outputting results in bulk, even when dealing with asynchronous operations.

While Apps Script doesn’t natively support generators, Bruce has found a handy converter published by Facebook to make them compatible. As part of the post Bruce includes some Apps Script samples you can test and modify, demonstrating how to apply these techniques in real-world scenarios, even within the limitations of the platform. Bruce provides clear explanations of these concepts, illustrated with practical examples like finding breweries near specific locations and well worth spending the time to digest.

Source: Paging large data sets and how to make Apps Script understand generators – Desktop liberation

Quickly append file permissions in Google Drive with Google Sheets and Google Apps Script

Quickly append new permissions to existing files within Google Drive. Insert email addresses using a comma-space format with optional notifications.

Quickly append new file permissions via a Google Sheet

The following Google Apps Script tool allows you to quickly append new permissions to existing files within Google/Shared drive. This is quite a niche tool so it is anticipated you would already have a Google Sheet of file IDs/URLs, though there is the option to select an existing Drive folder of files and automatically bring them into this tool.

By inserting email addresses using a comma-and-space format you can optionally select to send a notification email to the new user(s)

You can continue to append further rows to the Google Sheet as existing ones will be skipped once the ‘Status’ column has automatically been marked as ‘Completed’. Alternatively you can clear the Sheet each time for a fresh start.

Source: The Gift of Script: Append Drive file permissions Tool

Effortlessly integrate WooCommerce customer data in Google Sheets with a little Google Apps Script

Learn how to easily export your WooCommerce customers email, name and address to Google Sheets using Google Apps Script. The script will create a new tab in your Google Sheet and copy the data from the WooCommerce customers table.

If you are a WooCommerce store owner you might be interested in this solution by Amit Agarwal who provides a step-by-step guide on how to export WooCommerce customer data (email, name, address) to Google Sheets using Google Apps Script.

No more manual CSV exports or complex integrations, simply copy the provided script and follow the setup instructions. With this solution you can enhance your workflows, gain insights, and enhance your customer outreach. If you are not an existing WooCommerce user a solution for developers to keep in mind if you are seeking to optimise your Google Workspace add-ons customer experience.

Source: How to Export WooCommerce Customers to Google Sheets – Digital Inspiration

Unlock the power of charts: Get your free Google Sheets visual vocabulary template from Ben Collins 

Enhance your Google Sheets skills with this Visual Vocabulary template. Learn how to choose the right charts, create effective visualizations, and design professional-looking dashboards. This comprehensive guide includes 31 common chart types, tips for data organization, and step-by-step instructions for using the SUBTOTAL formula to create interactive “Show/Hide” rows. Perfect for data enthusiasts and spreadsheet users of all levels!

Friend and fellow GDE, Ben Collins, has recently announced a new ‘Sheets Insiders’ membership program where he’ll be sharing some exclusive members-only newsletters, new templates, deep-dive tutorials, and more for both Google Sheets and Apps Script.

If you would like to ‘try before you buy’ Ben has shared the first issue of the Sheets Insiders membership program, featuring a Visual Vocabulary template for Google Sheets. The template is designed to help you in chart selection and the accompanying videos include lots of great tips to help you cleanly format your spreadsheets.

Future Sheets Insiders issues will delve into chart tricks, dropdown menus, interactive elements, AI and Sheets integration, formula challenges, and Apps Script content. The newsletter content will be archived in the Sheets Insiders Content Library for future reference. Click through to read more about Sheets Insiders and get your copy of the Google Sheets Visual Vocabulary Template.

Source: Sheets Insiders 1: Visual Vocabulary Template

Check comma separated email address is valid

Loop through a Google Sheet cell of comma-space separated email addresses and check their format is valid, otherwise display a user popup.

The following Google Apps Script is designed to loop through a Google Sheet cell of email addresses that have been separated by a comma and space. It then uses a regular expression (regex) to confirm the email address meets the correct formatting criteria.

This code was developed as a way of implementing additional checks when asking users to be precise in how exactly they enter multiple email addresses. So if they were to forget the space for instance it could alert them, before the rest of the code risked failing as whatever task it was designed to do.

Source: The Gift of Script: Check comma separated email address is valid

NEW AppSheet Admin Console in Public Preview! Key AppSheet licensing considerations for Admins

 

Image credit: Google

Workspace admins with the AppSheet service privilege now have visibility into the activities of their users, apps and licenses via the new AppSheet Admin Console

The Google AppSheet team recently announced the public preview of a new AppSheet Admin Console. The new Console gives Workspaces Admins greater visibility of AppSheet usage within their domain, including AppSheet Core users. The new Console is a big step forward in providing admins a centralized platform to monitor and manage AppSheet usage, licensing, and governance.

Key features include:

  • Insights into popular apps and top creators
  • Detailed app ownership and usage data
  • Comprehensive view of app users across the organization
  • Easy access to app sharing settings, performance, audit history, and version history
  • Exportable lists of accounts, users, apps, and licenses
  • User role management within the organization
  • Verification of AppSheet licenses (purchased, assigned, and used)
  • Access to usage monitoring data, even without an enterprise license

The linked announcement page also highlights some planned new features for the new Console include: historical app usage, individual app copy or transfer, self-serve provisioning, external user licensing, and a default organization model for new Workspace customers who purchase AppSheet Enterprise.

A key addition to the new Console is the AppSheet licensing summary. There are some important considerations Admins should start thinking about around AppSheet licenses, in particular, the creation or sharing of AppSheet apps with Enterprise features to unlicenced or Core users.

Previously under the legacy Team licensing model it was possible for an AppSheet Core user to create and share apps with AppSheet Enterprise features. As Google moves to an assigned model Admins will need to reconcile the required licenses for their domain. The good news is Google has said

“In the short team, no users will be blocked. Admins will be given several months advanced notice before stricter license enforcement.”

There is also more information on How AppSheet Enterprise Plus licenses are provisioned.

Source: AppSheet Admin Console in Public Preview!