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 / 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);
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
@Max-Makhrov
Max-Makhrov / exportSpreadsheet.gs
Last active September 25, 2019 12:15 — forked from Spencer-Easton/exportSpreadsheet.gs
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@Max-Makhrov
Max-Makhrov / .block
Last active June 25, 2019 14:34
d3.js v5. Bar Charts + Hello, world!
height: 800
scrolling: no
border: no
// 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 08:48
Formulas for Cartessian cross-join in Google 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, )
)
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;
// 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;
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 March 30, 2018 11:35
The code helds to copy sheets between files in 1 click
/* 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
*/