Skip to content

Instantly share code, notes, and snippets.

Avatar
😋

Max Makhrov Max-Makhrov

😋
View GitHub Profile
@Max-Makhrov
Max-Makhrov / .block
Last active Jun 25, 2019
d3.js v5. Bar Charts + Hello, world!
View .block
height: 800
scrolling: no
border: no
View const_.gs
// sample files are here: https://drive.google.com/drive/folders/1U4GrMHHyakOoCG3PVehkQD_AKADvFdVL
var C_FILE_TRIGGER_ID = ''; // Put your file id here if you plan to use it as Library
var C_SHEET_EVAL = '_Ini_';
var C_RANGE_VALS = 'C2:D';
var CCC_ = {}; // for holding constants
var C_DELIMETER1_NAME = 'STR_DELIMEER1';
// get settings from named range
function getSettings_(getAgain)
@Max-Makhrov
Max-Makhrov / Cross-join-Google-Sheets2.1.sheets
Last active May 5, 2021
Formulas for Cartessian cross-join in Google Sheets
View Cross-join-Google-Sheets2.1.sheets
=ArrayFormula(
VLOOKUP(
CEILING(ROW(OFFSET(INDIRECT("A1"),,,COUNTA(A2:A)*COUNTA(B2:B)))/COUNTA(B2:B)) ,
{ROW(A2:A)-row(A1),A2:A} , 2, )
)
View Google-Spreadsheet-Delete-Extra-Cells.gs
var C_COLS_LEAVE = 1;
var C_ROWS_LEAVE = 25;
function deleteEmptyCells() {
var file = SpreadsheetApp.getActive();
var sheets = file.getSheets();
for (var i = 0, l = sheets.length; i < l; i++) { deleteEmptyCellsSheet_(sheets[i]); }
return 0;
View Delete-Rows-Condition.gs
// SETTINGS
var C_VALS = ['ABC' , 'DEF' , 'GHI' , 'JKL' , 'MNO' , 'PQR' , 'STU' , 'VWX' , 'YZA'];
var C_SHEETS = ['Sheet1'];
var C_COLUMN = 'H';
function test_deleteSheetRowsWithSettings()
{
var values = C_VALS;
var sheets = C_SHEETS;
View Settings-Dependent-Dynamuc-Drop-Down-Lists.gs
function onEdit(event)
{
// Change Settings:
//--------------------------------------------------------------------------------------
var TargetSheet = 'Main'; // name of sheet with data validation
var LogSheet = 'Data1'; // name of sheet with data
var NumOfLevels = 4; // number of levels of data validation
var lcol = 2; // number of column where validation starts; A = 1, B = 2, etc.
var lrow = 2; // number of row where validation starts
@Max-Makhrov
Max-Makhrov / Copy-multiple-Sheets-Google-Speadsheets.gs
Created Mar 30, 2018
The code helds to copy sheets between files in 1 click
View Copy-multiple-Sheets-Google-Speadsheets.gs
/* Done!
1. Copy multiple sheets between files with 1 click
2. Delete "copy of..." from sheet name. Leave original name if possible*.
3. Delete and recreate named ranges. Leave original name if possible.
4. Repair formulas → to prevent #N/A, #Ref errors
* no naming conflicts
*/
View Cannot-call-method_of-null.js
function test_Error()
{
var file = SpreadsheetApp.getActive();
var sheet = file.getSheetByName('No Such Sheet!');
var range = sheet.getRange(1, 1);
var value = range.getValue();
Logger.log(value);
View SingleFormula-Calendar-in-Google-Sheets.js
={"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ; ArrayFormula(VLOOKUP((ROW(INDIRECT("a1:a83"))-1)*7+TRANSPOSE(ROW(INDIRECT("a1:a7"))),{ROW(INDIRECT("a1:a588")),IF(TRANSPOSE(SPLIT(JOIN("",rept("0,",WEEKDAY(EOMONTH(A1,row(INDIRECT("a1:a12"))-2)+1))&REPT("1,",DAY(EOMONTH(A1,row(INDIRECT("a1:a12"))-1)))&rept("0,",49-DAY(EOMONTH(A1,row(INDIRECT("a1:a12"))-1))-WEEKDAY(EOMONTH(A1,row(INDIRECT("a1:a12"))-2)+1))),",")),MOD(ROW(INDIRECT("a1:a588"))-1,49)+1-VLOOKUP(CEILING(ROW(INDIRECT("a1:a588"))/49),{ROW(INDIRECT("a1:a12")),WEEKDAY(EOMONTH(A1,row(INDIRECT("a1:a12"))-2)+1)},2,),TRANSPOSE(SPLIT(rept(rept(" ,",42) & "Sun,Mon,Tue,Wed,Thu,Fri,Sat,",12), ",")))},2,)) }
View onEdit-TimeStamp-Lab.js
/*
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
*/
/*
_____ _ _ _ __
| __ \ | | | | | | \ \
| |__) |_ _ ___| |_ ___ | |__| | ___ _ __ ___ \ \
| ___/ _` / __| __/ _ \ | __ |/ _ \ '__/ _ \ \ \