Closed uknj closed 10 years ago
Currently, you can only assign a variable to a cell
So does this mean something like : function fireUpdate(key) { //Update Google spreadSheet
spreadsheet.add({ key : { 3: "404 map is gone!" } });
spreadsheet.send(function(err) {
if(err) throw err;
});
}
would not work ? If so ive been trying for hours to make this fire... I dont understand why i cannot take a var, it only makes sense if your running the script in a loop, no ?
All i get is : WARNING: Rkey0C3 already exists Sending updates...
Where key is the name of my var, is this just a regex problem ? I think this feature should be a must. Unless im not using this correctly.
I found a "fix" ... this lets me use my row number from a var.
There was probably a cleaner way to do this, but hey im on my second day in Node... ;)
function fireUpdate(key, errMsg) {
eval('spreadsheet.add({ "' + key + '" : { 3: "' + errMsg + '" } });');
spreadsheet.send(function(err) {
if(err) throw err;
});
}
You can do that without eval
like so:
function fireUpdate(key, errMsg) {
var obj = {};
obj[key] = { 3: { errMsg }};
spreadsheet.add(obj);
spreadsheet.send(function(err) {
if(err) throw err;
});
});
Great answer ! thank you very much :)
On Tue, Oct 21, 2014 at 3:47 AM, Jaime Pillora notifications@github.com wrote:
You can do that without eval like so:
function fireUpdate(key, errMsg) { var obj = {}; obj[key] = { 3: { errMsg }}; spreadsheet.add(obj); spreadsheet.send(function(err) { if(err) throw err; });});
— Reply to this email directly or view it on GitHub https://github.com/jpillora/node-edit-google-spreadsheet/issues/34#issuecomment-59890940 .
Marc Gaumont mgaumont.infographe@gmail.com
Is it possible to assign a variable to a column or row number in order to have the row that data is input to change every time a script is run.