| Screenshot of Sheet data to create a Doc for |
I'm Phil Bainbridge and I aim to share my experiences of IT projects I've worked on as I continue to learn and develop, through this blog. My main coding language is Google Apps Script (with JavaScript), but there is also some: PowerShell, HTML, SQL and jQuery.
Tuesday, 23 May 2023
Create a Google Doc for a single row of Sheet data
Tuesday, 9 May 2023
Google Add-on: Bulk Rename Files update May 2023
What it does
Bulk rename Google Drive files quickly and easily with this Add-on. You define exactly what you want to search for in the file name and the text to replace it with. Along with options for handling special characters and append/prepend to the existing file name. Works across My/Shared drives.
Update
- Sequential numbering
- Append/prepend a sequential number to the existing file name that will automatically increment as it loops through the files.
- In the search text enter '<<SEQUENCEXX>>' where 'XX' is the number sequence you wish to use (it can be more/less that 2 digits long). In the replacement text enter a combination of '<<SEQUENCE>>' and '<<KEEPNAME>>' depending on if you want to append/prepend.
- Original file name example 1: 'My sample file'.
- New file name example 1: 'My sample file 01'. So search text would be '<<SEQUENCE01>>' and replacement text '<<KEEPNAME>> <<SEQUENCE>>'.
- Original file name example 2: 'Building code'.
- New file name example 2: '005 Building code BC'. So search text would be '<<SEQUENCE005>>' and replacement text '<<SEQUENCE> <<KEEPNAME>> BC' .
| Add sequential numbers to existing file names |
Tuesday, 11 April 2023
Google Form Checkbox responses
The following Google Apps Script is an example of one way to get the responses from a Checkbox-type question on a Google Form and how you might go about differentiating them.
This came up for a project I was working on where I need to put a Yes/No value into 3 separate Google Sheet cells based on 3 options in a question. The slight challenge is that all of the responses come out as a single array for this question, containing the strings of the values that have been ticked only.
| Get all checkbox responses from a Form |
Tuesday, 28 March 2023
Switch view to a specific Google Sheet
The following Google Apps Script code is designed to switch the active sheet that the user is currently looking at to that of another within the same Google Sheet file. This is a snippet of code that could be placed at the end of a function when archiving data from one sheet to another for instance, and you want the destination to be shown to the user.
| Apps Script Code to switch the active view for a user |
Tuesday, 14 March 2023
Read & write multiple User Properties
The following Google Apps Script is a few snippets of some larger code where I needed to write (and then later read back) a number of User Properties in one go. Rather than creating multiple single write requests it is more efficient to do this in bulk.
I also needed a way to bulk read/extract these values later from a JavaScript Object that would allow me to easily call the Property name and get its value in return.
| Access User Properties and get the values in an Object |
Tuesday, 28 February 2023
Delete Google Calendar Events by keyword and date range
Tuesday, 21 February 2023
Google Add-on: Bulk Rename Files update Feb 2023
What it does
Bulk rename Google Drive™ files quickly and easily with this Add-on. You define exactly what you want to search for in the file name and the text to replace it with. Along with options for handling special characters and append/prepend to the existing file name. Works across My/Shared drives.
Update
- Special characters
- The tool can handle: - [ ] / \ { } ( ) * + ? . ^ $ | #
- You could remove individual characters:
- Original file name example: 'Archive backup (ready)'.
- New file name example: 'Archive backup ready'.
- You could replace these characters with others:
- Original file name example: '.backup folder'.
- New file name example: '_backup folder'.
- You could both remove and replace them at the same time:
- Original file name example: 'This experiment belongs to _[Sample]'.
- New file name example: 'This experiment belongs to Phil'.
- Append / Prepend
- You can add text/characters to the beginning and/or end of the existing file name.
- In the search text enter '<<KEEPNAME>>' and in the replacement text enter 'Something before <<KEEPNAME>> something after'.
- Original file name example: 'is my'.
- New file name example: 'This is my Document'. So replacement text would be: 'This <<KEEPNAME>> Document'
| Append / Prepend to the existing file name |
Tuesday, 14 February 2023
Google Add-on: Convert Drive Files
What it does
Bulk convert Google Drive files quickly and easily with this Add-on. Convert between Google, Microsoft Office, PDF, etc.
Point the Add-on at a Google Drive folder, select the file types you want to convert, select your destination folder and whether you want the original file to be deleted, then hit go!
Saves having to go into each file individually, selecting the file type to download and then selecting the save destination.
Convert File Types
Google Doc™ to PDF | Microsoft Word™ | OpenDocument Text | Rich Text Format | HTML
Google Sheet™ to PDF | Microsoft Excel™ | OpenDocument Spreadsheet
Google Slide™ to PDF | Microsoft PowerPoint™ | OpenDocument Presentation
Google Drawing™ to PDF | JPEG | PNG | SVG
Microsoft Word™ to PDF | Google Doc™ | OpenDocument Text | Rich Text Format
Microsoft Excel™ to PDF | Google Sheet™ | OpenDocument Spreadsheet
Microsoft PowerPoint™ to PDF |Google Slide™ | OpenDocument Presentation
Plain Text to Google™ Doc | Microsoft Word™
PNG | BMP to JPEG
More being added ...
Find out more
Convert Drive Files Add-on webpage - includes instructions and a demo video.