Skip to content

Instantly share code, notes, and snippets.

View Max-Makhrov's full-sized avatar
🇺🇦

Max Makhrov Max-Makhrov

🇺🇦
View GitHub Profile
@Max-Makhrov
Max-Makhrov / beep2telegram.gs
Last active October 15, 2022 10:05
send a message to Telegram with Bot from WebApp. Google Apps Script
var token = "1234697707:AAHGyL2PE..."; // CHANGE1
function doPost(e) {
var chat_id = -0123456789; // CHANGE1
var msg = e.parameter.msg;
if (!msg || msg === '') {
return returnXml_('no message');
}
// uncomment to prevent same messages
// if (inMemory_(msg)) {
@Max-Makhrov
Max-Makhrov / beep2telegram_v2.gs
Last active August 10, 2022 10:57
Send a message to Telegram with Bot from WebApp. Google Apps Script
// 1️⃣ change settings
// Telegram token
var token = "826438459:AAH2hEf7YZq...";
// Spreadseet id for storing memory
// Sample:
// https://docs.google.com/spreadsheets/d/1pI12qRVgIY7i03tVdd9jNd2GwPDgOi1RLthdpVpdMD8
var memory_sets = {
// please refer here for more info:
// https://sheetswithmaxmakhrov.wordpress.com/2018/01/03/smart-data-validation-create-dependent-drop-down-lists-in-goole-sheets/
function onEdit(event)
{
var maxRows = false;
// Change Settings:
//--------------------------------------------------------------------------------------
var TargetSheet = 'Main'; // name of sheet with data validation
@Max-Makhrov
Max-Makhrov / submit.md
Last active March 5, 2022 00:33 — forked from tanaikech/submit.md
Uploading Local Files to Google Drive without Authorization using HTML Form

Uploading Local Files to Google Drive without Authorization using HTML Form

This is a sample script for uploading local file to Google Drive without the authorization using HTML form. A selected file in your local PC using HTML form is uploaded to Google Drive and saved to Google Drive.

When you use this, at first, please deploy Web Apps. The script is doPost() of following scripts.

Script : Google Apps Script

function doPost(e) {
 var data = Utilities.base64Decode(e.parameters.data);
// The function may be used to prevent conflicting launches
function test_PreventConflict() {
// Lock(1). Use Script memory
var key = 'any-key-you-want';
var mem = PropertiesService.getScriptProperties();
// Lock(2). Check if other instance of the code is running
var from = mem.getProperty(key);
if (from) {
@Max-Makhrov
Max-Makhrov / Timer.gs
Created April 23, 2021 14:28
Timer is a code for monitoring onMinute triggers
function readTimer() {
// [ 1 ]. Get report
var tags = ['onMinute_admin', 'onMinute_worker', 'onMinute_importer', 'onMinute_sizif1', 'onMinute_sizif2'];
var report = getTimerReps_(tags);
console.log(report);
// => gives 2D Array with a report about executions.
// So U can write it on Spreadsheet.
// [ 2 ]. Gat all data from logs
@Max-Makhrov
Max-Makhrov / combine.gs
Last active June 9, 2021 07:26
Combine data from multiple sheets to 1
// combine data from all sheets in current file
function combineData() {
// CHANGE SHEET NAME ↓ /////////////////////////////
var sheetTo = 'combined';
////////////////////////////////////////////////////
var file = SpreadsheetApp.getActiveSpreadsheet();
var sheets = file.getSheets(); // get all the sheets
// set where we want to write the results
var outSheet = file.getSheetByName(sheetTo);
var outdata = [], sheet, sName, data = [];
@Max-Makhrov
Max-Makhrov / Dependent DropDowns 2D Wide. v0.gs
Last active May 27, 2021 06:21
2D Dependent Dropdowns for Google Sheets. ~70 lines of code. Classy sample
// Copy sample file here:
// https://docs.google.com/spreadsheets/d/1hUOuDZcfXxaLvJbEA-SxzF4oGGU3lW3iJyS4wAV8YWA/copy
function onEdit(e) {
dvl0_(e);
}
function dvl0_sets_() {
return [
{
@Max-Makhrov
Max-Makhrov / Code.gs
Created May 19, 2021 11:28
Google Script. HTML-form to select image from computer and save it to Google Drive and to Sheet cell as image.
// sample file:
// https://docs.google.com/spreadsheets/d/1_rk4xFsMrxiuXqo5-HQWfvOjBU6nGDw1rlJFU0sci9U/copy
function onOpen() {
var ui = SpreadsheetApp.getUi();
// Or DocumentApp or FormApp.
ui.createMenu('🙂 Click me')
.addItem('Image 🖼️ to Drive', 'showFormImages')
.addToUi();
}
function test_parse() {
var file = SpreadsheetApp.getActive();
var sheet = file.getSheetByName('Sheet1'); // change
var sets = {
rangeParse: sheet.getRange('L2:L16429'), // change
rangeResult: sheet.getRange("M2"), // change
func_parse: parseOkkoFilmToGetHorizontalPoster_ // change / create your function
};
parseUrls_(sets);
}