AppsScriptPulse

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 Doc to clean HTML converter for Google Apps Script

Export Google Doc as clean html. Handy to make a WordPress post from Google Doc. – thejimbirch/GoogleDoc2Html

Following on from our previous post highlighting Amit Agarwal’s Send Rich Text HTML Emails with Google Sheet  we received the following recommendation for a Google Doc to HTML converter solution from @IMTheNachoMan:

For those interested in workflows for using Google Docs as an email template this solution already has a emailHtml() function you can build on which appears to already inline images from your Google Doc.

Source: thejimbirch/GoogleDoc2Html

Retrieve previous versions of Google Apps Script projects

Photo by James Lee on Unsplash

Retrieve the source code linked to a specific version of your Apps Script project then save it as a new Apps Script project – RomainVialard/access-code-of-older-versions

Neat solution from Romain Vialard to retrieve a previous version of your Apps Script code. There is an open feature request to have this as a built-in feature of Apps Script (as noted by Romain recovering a previous script version is also possible using clasp using pull and an optional version number).

Source: RomainVialard/access-code-of-older-versions

RichTextApp – a Google Apps Script library for copying rich text formatting from Google Docs and Sheets

This is a GAS library for copying the rich text with the text styles from Google Document to Google Spreadsheet or from Google Spreadsheet to Google Document using Google Apps Script (GAS). And, also the rich texts in the cells can be converted to HTML format.

Nice little helper library for copying rich text formatting from Google Docs and Sheets. You can view the project README for information on the formats that are currently supported. Personally, the inclusion of the RichTextToHTMLForSpreadsheet method looks particularly useful for converting rich text formatting in Google Sheets cells to HTML for mail merge applications.

Source: tanaikech/RichTextApp

Taking Advantage of Google Apps Script (Tanaike’s list)

Kanshi Tanaike is a prolific Google Apps Script developer and we’ve often featured solutions are reports that Tanaike has shared. With this in mind Tanaike’s list of Google Apps Script resources is well worth a browse.

Source: tanaikech/taking-advantage-of-google-apps-script

Change Tab Detection on Google Spreadsheet using onSelectionChange Event Trigger with Google Apps Script

Change Tab Detection on Google Spreadsheet using onSelectionChange Event Trigger with Google Apps Script – submit.md

An example script from Kanshi TANAIKE which lets you test the new onSelectionChange(e) simple event trigger in Google Sheets.

The onSelectionChange(e) trigger runs automatically when a user changes the selection in a spreadsheet.

In the example shared this is used to detect the user changing Google Sheet tab.

Source: Change Tab Detection on Google Spreadsheet using onSelectionChange Event Trigger with Google Apps Script

Interacting with multiple hyperlinks in Google Sheets cells with Google Apps Script

Before this, when a cell has only one hyperlink. In this case, the hyperlink was given to a cell using =HYPERLINK(“http://www.google.com/”, “Google”) but by a recent update, a cell got to be able to have multiple hyperlinks … In this report, I would like to introduce the method for setting and retrieving the multiple URLs for a cell.

Hyperlinks in Google Sheets cells is a bit of an obsession of mine and it’s nice to see Kanshi TANAIKE has a similar passion. Google are rolling out multiple hyperlinks in Google Sheet cells and Tanaike has provided details on how the hyperlink values can been get/set with Google Apps Script (the official docs are still catching up with Tanaike’s discovery :)

Source: Updated Specification of Google Spreadsheet: Multiple Hyperlinks to a Cell

DNSQuery and G Suite domain detection in Google Sheets using the Cloudflare name resolution service

Dos funciones personalizadas para hojas de cálculo de Google desarrolladas en Apps Script que proporcionan un envoltorio para la función NSLookup, tal y como aparece en la documentación del servicio de resolución de nombres de CloudFlare. Consulta el registro indicado en el o los dominios que se pasan como parámetro utilizando el servicio de resolución de nombres de CloudFlare. Determina si un email o dominio (o lista de emails o dominios) está gestionado por Google o no. – pfelipm/dnsquery

Pablo Felip Monferrer has shared two custom functions for Google Sheets that provide an extension to the NSLookup function originally shared by Cloudflare. The first is a wrapper that makes it easy to list specific DNS record types for a single or list of domains. The second function uses the domains MX record to automatically detect if a domain has G Suite Gmail settings applied.

Source: pfelipm/dnsquery

Proof of concept of how to get namespaces (sorta) in Google Apps Scripts libraries

Proof of concept of how to get namespaces (sorta) in Google Apps Scripts libraries – classroomtechtools/NamespacedLib

For the seasoned Google Apps Script library author a continual frustration is the inability to get the online Script Editor to autocomplete if you have sub methods within your namespace. Adam Morris has discovered that the @name attribute can be used to fake this behavior … to a degree.

Source: classroomtechtools/NamespacedLib

Things one can get used to for the V8 Google Apps Scripts engine

A bit of a monologue about various syntax changes and adjustments in learning and using the tool.

Great post from Adam Morris (@clssrmtechtools) aimed at Google Apps Script developers wanting to start coding with the more modern JavaScript syntax used in V8. Adam shares lots of great advice to get started and build upon.

Source: Things one can get used to for the V8 Google Apps Scripts engine