Last active
June 22, 2017 16:35
-
-
Save RyanRusnak/fd2f2361a117dbd1b4e62dec27b8edf5 to your computer and use it in GitHub Desktop.
google sheet helper functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SHEET = SpreadsheetApp.getActiveSheet(); | |
function toArray(){ | |
var arr = SHEET.getRange("A1:D1").getValues()[0]; | |
Logger.log(arr); | |
} | |
function toMatrix(){ | |
var hash = SHEET.getRange("A3:B5").getValues(); | |
Logger.log(hash); | |
} | |
function toHash(matrix){ | |
var hash = {}; | |
for (var i = 0; i < matrix.length; i ++){ | |
hash[matrix[i][0]] = matrix[i][1]; | |
} | |
return hash; | |
} | |
function testHash(){ | |
var values = SHEET.getRange("A3:B5").getValues(); | |
Logger.log(toHash(values)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment