Created
November 19, 2014 14:10
-
-
Save dangtrinhnt/320e425b26ac3c5ca987 to your computer and use it in GitHub Desktop.
Convert row data to dictionary using Google Apps Script
This file contains 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
function rowToDict(sheet, rownumber) { | |
var columns = sheet.getRange(1,1,1, sheet.getMaxColumns()).getValues()[0]; | |
var data = sheet.getDataRange().getValues()[rownumber-1]; | |
var dict_data = {}; | |
for (var keys in columns) { | |
var key = columns[keys]; | |
dict_data[key] = data[keys]; | |
} | |
return dict_data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you so much!