Answer the question
In order to leave comments, you need to log in
Google Docs Sheets - how to put an array of data into a variable in jquery-google-sheet-to-json?
Hello friends, I have an interesting problem. You need to get cell values from a Google Docs Sheets document, and use JS to process certain values using mathematical operations on the site.
In general terms, everything is almost ready, using the
jquery-google-sheet-to-json
plugin, we
managed to get an array of data (document cells) in JSON format. But now I can not figure out how to drive the data into a regular variable. I understand that for many my question will seem stupid, but apparently I can’t handle it myself.
In general, the above plugin has this function (file *jquery-google-sheet-to-json-master\jquery-google-sheet-to-json-master\examples\basic\ example.js ):
worksheets.forEach(function(worksheet){
$.googleSheetToJSON('1nmrLOKhY_XB9vYgr-8xYTQ7dAB7AykY9G-UolHvcit0', worksheet)
.done(function(rows){
var $container = $('<div>');
$container.append('<h1>' + (worksheet || 'default') + '</h1>');
rows.forEach(function(row){
$dl = $('<dl>');
Object.getOwnPropertyNames(row).forEach(function(name){
var val = [].concat(row[name]).join(' / ');
$dl.append('<dt>' + name + '</dt><dd>' + val + '</dd>');
});
$container.append($dl);
});
$(document.body).append($container);
})
.fail(function(err){
console.log('error!', err);
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question