I can successfully assign scripts to images in Google spreadsheets. My problem is with parameter passing.
I have this script to write the current time on a cell.
function Time(cell){
var d = new Date();
var timeAsString = d.getHours() + ":" + d.getMinutes() + "/" + d.getSeconds();
SpreadsheetApp.getActiveSheet().getRange(cell).setValue(timeAsString);
};
I need a bunch of buttons to do this with diferent cells, so I wish to specify which cell the time goes to by parameter.
Many tx.
Sorry, but this really doesn't solve my problem. I don't want user input. The idea is to have a button associated to each cell. The user just presses a button and the cell is filled with a timestamp. If the user must input the cell name, it's ruined. Current solution works but it's ugly:
function Time(cell){
var d = new Date();
var timeAsString = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
SpreadsheetApp.getActiveSheet().getRange(cell).setValue(timeAsString);
};
function TimeB12(){Time('B12')};
function TimeB13(){Time('B13')};
// about 500 more cells...
I then associate script TimeB12 to button next to cell B12, and so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With