Skip to content

Instantly share code, notes, and snippets.

Avatar
😋

Max Makhrov Max-Makhrov

😋
View GitHub Profile
@Max-Makhrov
Max-Makhrov / GooogleSheetsToWeb.js
Last active Jun 10, 2016
trying to export Json data from Google Sheets
View GooogleSheetsToWeb.js
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script>
$(document).ready(function() {
getSheetData();
});
function getSheetData() {
View SheetRockTest1
<table id="statistics" class="table table-condensed table-striped"></table>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<script src="https://chriszarate.github.io/sheetrock/dist/sheetrock.min.js"></script>
<script>
var mySpreadsheet = 'https://docs.google.com/spreadsheets/d/1i_eJ1XyQXATMCanAZl55z_WAs_Lj0rad-lUnK7jhxz8/edit#gid=0';
// Load an entire worksheet.
$('#statistics').sheetrock({
url: mySpreadsheet
@Max-Makhrov
Max-Makhrov / getDataFromSheet.js
Created Nov 2, 2017
Get Sheets data into array
View getDataFromSheet.js
function getDataFromSheet()
{
var sheet = SpreadsheetApp.getActiveSheet(); // get active sheet
var range = sheet.getDataRange(); // get range object containing data
var data = range.getValues(); // write range data into array called data
Logger.log(data); // Log Data. To see the result run function and press <Ctrl + Enter>
}
@Max-Makhrov
Max-Makhrov / 2DArraySample.js
Last active Nov 2, 2017
2d Array, how data stored in Goolge Sheets
View 2DArraySample.js
[ ['Name', 'Sum'],
['Max', 500],
['Lu',  150] ]
View Cross-join-Google-Sheets.sheets
=ArrayFormula(
transpose(split(rept(concatenate(A2:A&char(9)),counta(B2:B)),char(9)))
&" "&
transpose(split(concatenate(rept(B2:B&char(9),counta(A2:A))),char(9)))
)
View Dinamic-Cell-Refenence
=ADDRESS(1,1,4,,"Sheet1")&":"&ADDRESS(COUNTA(Sheet1!A:A),COUNTA(Sheet1!1:1),4)
View Collect-From-Sheets.js
var C_RANGE_EVAL = 'eval';
// Declare
var STR_DELIMEER1 // delim1
var STR_DELIMEER2 // delim2
var STR_IDS // files ids
var STR_SHEETS // sheet names
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 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);