The following Google Apps Script script automatically adds hyperlinks to text following a given pattern in Google Sheets cells.
The pattern provided below will automatically add hyperlinks to strings matching
[SheetName!Range]
. For instance, [Foo!B4]
will point to #gid=<foo_gid>&range=B4
.
/** @type [RegExp, (match: RegExpExecArray, range: SpreadsheetApp.Range) => string | undefined][] */
const patterns = [
[ /\[(\w+!)?([A-Z]+[0-9]+(?::[A-Z]+[0-9]+)?)\]/g,