Skip to content

Instantly share code, notes, and snippets.

View dnalob's full-sized avatar
🎯
Focusing

dnalob

🎯
Focusing
View GitHub Profile
@dnalob
dnalob / macro.gs
Created December 27, 2019 04:06 — forked from bran921007/macro.gs
A lot of macro script samples (Format text, Convert all formulas to valus in sheet, Sort sheets alphabetically, unhide all rows and collumns, reset filter, etc)
// 3. Format Text Example
function FormatText() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getActiveRangeList().setFontWeight('bold')
.setFontStyle('italic')
.setFontColor('#ff0000')
.setFontSize(18)
.setFontFamily('Montserrat');
};
@dnalob
dnalob / text-to-columns.js
Created December 27, 2019 04:00 — forked from dDondero/text-to-columns.js
Miss text to columns functionality (ex. .csv file to rows) in Google Apps. Here is a script that creates an extra menu with a few useful functions. Published by Evan Plaice on StackExchange. I share it here because it was very useful to me and hopefully more will find it.
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [];
menuEntries.push({ name:"Text to columns", functionName:"textToColumns" });
menuEntries.push({ name:"Text to columns (custom separator)", functionName:"textToColumnsCustom" });
menuEntries.push(null);
menuEntries.push({ name:"Columns to Text", functionName:"columnsToText" });
menuEntries.push({ name:"Columns to Text (custom separator)", functionName:"columnsToTextCustom" });
ss.addMenu("Advanced", menuEntries);
}
@dnalob
dnalob / find-cell-value-and-delete-row.js
Created December 27, 2019 03:56 — forked from dDondero/find-cell-value-and-delete-row.js
Google Apps script function to delete rows based on value in cell.
function deleteRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();
var rowsDeleted = 0;
for (var i = 0; i <= numRows - 1; i++) {
var row = values[i];
if (row[0] == 'delete' || row[0] == '') { // This searches all cells in columns A (change to row[1] for columns B and so on) and deletes row if cell is empty or has value 'delete'.