AppsScriptPulse

How to Request Payments with Razorpay and Google Sheets – Digital Inspiration

How to use Google Sheets to generate Razorpay payment links and easily accept payments from customers anywhere in the world!

Razorpay is a popular payment gateway in India that allows you to accept online payments from customers anywhere in the world. Your customers can pay with credit cards, debit cards, Google Pay, Walmart’s PhonePe and other UPI apps.

A great solution from Amit Agarwal for creating payment links in Google Sheets for Razorpay. The source post provides more details of how this works and setup required. The post also outlines how you can combine this with a mail merge to sort all your invoicing needs.

Source: How to Request Payments with Razorpay and Google Sheets – Digital Inspiration

Get the redirect location of a URL using Google Apps Script

Have a list of shortened urls and need their final destination? Use this custom function in google sheets to extract them all at once.

Handy little snippet that can make testing redirects on URLs a lot easier, which can be useful for expanding short links from social media sites like Twitter.

Source: get the redirect location of a url using google apps script

Bulk create Google Drive Folders and add Files

Bulk create Google Drive folders with optional files copied into each one. Also optionally add edit permissions to these folders/files.

Bulk create Google Drive folders and add files, from a Sheet of data

Bulk create Google Drive folders and add files, from a Sheet of data

The following Google Apps Script tool was developed to bulk create Google Drive folders with optional files copied in to each one, all from data within a Google Sheet. There is also the option to add specific ‘edit’ permissions to the newly create Drive folders of which the files would automatically inherit this access level.

Key Functionality:

  • Complete the necessary information in the Config sheet before proceeding. Then use the Create folders option from the Admin menu at the top of the Google Sheet.
  • Adding permissions is optional – use the Config sheet to change the dropdown as required. If you select ‘No’ then the usual Google Drive inheritance will occur based on the parent Google Drive folder.
  • You can add multiple File IDs into the relevant cell and they can be different for each row. Leaving this cell blank/empty means no files will attempt to be copied into the new folder.
  • The original filename will be updated during the copy to append the folder name to the end of it, in order to prevent creating a large number of files with identical names.
  • There is a Log sheet to help troubleshoot any errors which may occur when running the tool.

Source: The Gift of Script: Bulk create Google Drive Folders and add Files

How to Build Custom Functions in Google Sheets with Google Apps Script

Build your own functions in Google Sheets that do anything you need them to in a few lines of code.

This is a great tutorial if you are interested in finding out more about developing custom functions in Google Sheets. The post includes everything you need to get started from handling single cell and range inputs, to documenting your function so that users see inline help.

Source: How to Build Custom Functions in Google Sheets with Google Apps Script

Mergo – Mail Merge for Gmail – A free lifetime subscription for Google Workspace for Education users

As teachers gear up for the new school year, we’re glad to offer a free lifetime subscription to your school, college or university. 🥳

I’m sure many of you have come across Romain Vialard who has been contributing to the Google Apps Script community since the product was in beta.

Mergo, Mail Merge for Gmail, is one of the latest products to be developed by Romain and for Google Workspace for Education users the great news is that until the 20 September 2021 there is an offer for a free lifetime subscription! Follow the source link for more details.

Source: Mergo – Mail Merge for Gmail – Back to school

Website Status Monitoring using Google Sheets [and Google Apps Script with optional notifications to Google Chat]

A Spreadsheet-bound apps script solution to conduct automated status monitoring on websites listed by the user in a Google Sheets management file. A separate status log file in Google Sheets will be created so that users can easily integrate data with BI services such as Google Data Studio. Notifications of changes in website status will be sent to the user’s Gmail. An optional setting to send notifications to Google Chat is available.

Nice example of using Google Chat for individual/group notification. The developer of this is also very responsive on Github if you encounter issues or have suggested changes.

Source: Website Status Monitoring using Google Sheets

Search Google Drive files and extract row data

Search and extract the content of Google Drive files. Collate the row data into a collective Google Sheet.

Search and extract the content of Google Drive files

Search and extract the content of Google Drive files

This was created for a specific Subject Access Request but may be of interest/use to others.

Source: The Gift of Script: Search Google Drive files and extract row data

Tracking Google Sheet Opens with Google Apps Script

The basic principle behind tracking Google Sheet opens is the same as the one behind email tracking with a transparent pixel. In a Google Sheet, we will use the IMAGE()function, which will call a deployed Google Apps Script web app URL with some parameters in the query string. The web app will be able to do whatever you need among the following: record to a spreadsheet, create a message via a messenger, or simply send an email.

Source: Tracking Google Sheet Opens with Google Apps Script

Check the domain of an email address by regex

Compare a number of email addresses and check their domains against one you are filtering for via a regular expression.

Screenshot of email addresses in a Google Sheet cell

Screenshot of email addresses in a Google Sheet cell

The following Google Apps Script is designed to use a regular expression (regex) to confirm if an email address domain matches one we specify eg: @hotmail.co.uk, @gmail.com, @outlook.com

I developed the code so I could screen email addresses to make sure they only came from within the institution – otherwise it would have broken the tool I was developing for creating Zoom meetings. The email addresses in this example are all stored in one cell in a Google Sheet and are separated via a comma and a single space.

Source: The Gift of Script: Check the domain of an email address by regex

Import data from MS SQL Server to Google Sheets using Google Apps Script

Image created by Trang Nguyen Ngoc with the icons by Freepik, Pixel perfect and phatplus on Flaticon

There are many ways to push data from SQL Server to Google Sheets, including using Python or Google Apps Script. While Python is great for a heavy SQL query, I find it a bit of a hassle when it comes to scheduling. Meanwhile, Google Apps Script works perfectly well for middle-size SQL queries and the triggers make it very simple to schedule, there is also no need to use any API.

In this article, I will share with you how to push data from MS SQL Server to Google Sheets using Google Apps Script and the tips I learned when implementing the solution.

Continuing the SQL theme this post from Trang Nguyen Ngoc provides a useful overview and introduction for connecting to a MS SQL databases using JDBC service. The post is particularly useful as it contains some tips if you encounter issues with connection.

[Note: there have been some issues recently with the JDBC service and if you encounter problems we recommend checking the issuetracker]

Source: Import data from MS SQL Server to Google Sheets using Google Apps Script