How to extract URL from Link in Google Sheets using a formula?

After some update in 2020 all codes I have found on the Internet were broken, so here is my contribution: /** * Returns the URL of a hyperlinked cell, if it’s entered with control + k. * Author: @Frederico Schardong based on https://support.google.com/docs/thread/28558721?hl=en&msgid=28927581 and https://github.com/andrebradshaw/utilities/blob/master/google_apps/convertHiddenLinks.gs * Supports ranges */ function linkURL(reference) { var sheet = … Read more

How do I add formulas to Google Sheets using Google Apps Script?

This is done using the setFormula for a selected cell. Below is an example of how to do this. var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var cell = sheet.getRange(“B5”); cell.setFormula(“=SUM(B3:B4)”); You can also use setFormulaR1C1 to create R1C1 notation formulas. Example below. var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var cell = … Read more

Conditional Formatting from another sheet

For some reason (I confess I don’t really know why) a custom formula in conditional formatting does not directly support cross-sheet references. But cross-sheet references are supported INDIRECT-ly: =A1>INDIRECT(“SheetB!A1”) or if you want to compare A1:B10 on SheetA with A1:B10 on SheetB, then use: =A1>INDIRECT(“SheetB!A1:B10”) =A1>INDIRECT(“SheetB!”&CELL(“address”,A1)) applied to range A1:B10.

ArrayFormula and “AND” Formula in Google Sheets

AND doesn’t work that way with Array formulae because it ANDs the whole array together in the top left cell, regardless of number of dimensions. I.e. it checks if “”>”” which is FALSE, ANDed with anything it will return FALSE for the top left cell, that result is carried down. You can use multiplication of … Read more

Hash of a cell text in Google Spreadsheet

Open Tools > Script Editor then paste the following code: function MD5 (input) { var rawHash = Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, input); var txtHash=””; for (i = 0; i < rawHash.length; i++) { var hashVal = rawHash[i]; if (hashVal < 0) { hashVal += 256; } if (hashVal.toString(16).length == 1) { txtHash += ‘0’; } txtHash += hashVal.toString(16); … Read more

How to define global variable in Google Apps Script

You might be better off using the Properties Service as you can use these as a kind of persistent global variable. click ‘file > project properties > project properties’ to set a key value, or you can use PropertiesService.getScriptProperties().setProperty(‘mykey’, ‘myvalue’); The data can be retrieved with var myvalue = PropertiesService.getScriptProperties().getProperty(‘mykey’);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)