Skip to content

Instantly share code, notes, and snippets.

View PolarBearGG's full-sized avatar
💭
I may be slow to respond.

Vitaliy PolarBearGG

💭
I may be slow to respond.
View GitHub Profile
const PREFIX = 'prefix';
const EXTERNAL_ID = 'docId';
const TAB_NAME = 'tabName';
const LOCAL_NAME = 'localTabName';
const RANGE = false;
var documentProperties = PropertiesService.getDocumentProperties();
function importFromDoc(prefix = false, externalDocumentId = false, tabName = false, localTab = false, range = false) {
sudo npm cache clean -f
sudo npm update npm -g
sudo npm install -g n
sudo n stable
sudo node -v
sudo npm -v
@PolarBearGG
PolarBearGG / numbertostring.gs
Last active April 28, 2020 12:08
Convert number to text number like 1 - one
var mapNumbers = {
0 : [2, 1, "нуль"],
1 : [0, 2, "одна", "один"],
2 : [1, 2, "дві", "дві"],
3 : [1, 1, "три"],
4 : [1, 1, "чотири"],
5 : [2, 1, "п'ять"],
6 : [2, 1, "шість"],
7 : [2, 1, "сім"],
8 : [2, 1, "вісім"],
@PolarBearGG
PolarBearGG / createJSON.gs
Created February 13, 2020 13:58
Create JSON from google sheets
function exportSheetAsJSON() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var numCols = rows.getNumColumns();
var values = rows.getValues();
var output = "";
output += "{\""+sheet.getName()+"\" : {\n";
var header = values[0];
@PolarBearGG
PolarBearGG / google_redirect_remove.js
Created January 17, 2020 14:59 — forked from zachbrowne/google_redirect_remove.js
Userscript to remove URL redirection from google sites
// ==UserScript==
// @name Google Redirect Remove
// @id google_redirect_remove
// @namespace scripts.zachbrowne.com
// @description Remove URL redirection from google sites
// @license GPL v3
// @include *://www.google.*/*q=*
// @include *://www.google.*/*tbs=*
// @include *://www.google.*/search?*
// @include *://www.google.*/webhp?*
@PolarBearGG
PolarBearGG / Code.gs
Created January 17, 2020 14:58 — forked from clayperez/Code.gs
AUTO-Generate Unique IDs in Google Sheets
// AUTO GENERATE SIMPLE UNIQUE ID'S FOR NON-EMPTY ROWS
//
// Author: Carlos Perez, clayperez@gmail.com
//
// Purpose: This Google Sheets script fires when any cell is edited and
// inserts a random (reasonably unique) UID of ID_LENGTH length
// into the specified ID_COLUMN. For instance if the first column in the
// sheet specified by SHEETNAME is the column where you would like the
// UID injected, then ID_COLUMN should be 1.
//
/**
* ###########################################################################
* # Name: Hubspot Automation #
* # Description: This script let's you connect to Hubspot CRM and retrieve #
* # its data to populate a Google Spreadsheet. #
* # Date: March 11th, 2018 #
* # Author: Alexis Bedoret #
* # Modified by: Vitaliy Galushka #
* # Detail of the turorial: https://goo.gl/64hQZb #
* ###########################################################################
@PolarBearGG
PolarBearGG / TextToFloatWithReplace.gs
Last active January 11, 2020 09:51
Purify text and display it as a number
function parseFloat1(a) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var range = sheet.getRange(a).getValues();
var new_arr = [];
for (var i = 0; i < range.length; i++) {
var item = range[i]
var converted = parseFloat(item.toString().replace(/[^-?0-9.]/g, ""));
if (isNaN(converted))
@PolarBearGG
PolarBearGG / importrefresh.gs
Last active January 11, 2020 09:50
Refresh all imports in sheet
function RefreshImports() {
var lock = LockService.getScriptLock();
if (!lock.tryLock(5000)) return; // Wait up to 5s for previous refresh to end.
var id = "[YOUR SPREADSHEET ID]";
var ss = SpreadsheetApp.openById(id);
var sheet = ss.getSheetByName("[SHEET NAME]");
var dataRange = sheet.getDataRange();
var formulas = dataRange.getFormulas();
var content = "";
@PolarBearGG
PolarBearGG / jira.gs
Last active January 11, 2020 09:49
get jira issues list
// Maximum results to retrieve per api request:
var C_MAX_RESULTS = 250;
// When spreadsheet opens, this sets up the custom Jira and Story Cards menus, and the functions that they call when selected:
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [{
name: "Configure Jira",
functionName: "jiraConfigure"