I have a spreadsheet with three columns and lots of rows.

Column A has a numerical ID Column B is empty Column C is empty

I want to have a button in each row in column C. When pressed, it should take the information in column A of the same row and do some processing on it and output the result in column B. The processing will make use of outside servers to do some data fetching, hence I cannot do this on sheet load because of "data overload". (actually I tried first, but it takes ages, times out etc with many rows). So I want to have it load that information adhoc, on the press of a button on the same line.

I have looked around and it seems that the only way to make buttons is to make a drawing of a button and then tie that button to a script. The problem with this approach is that the buttons aren't tied to a a cell so I can't get the current row number where the button is, to do processing on only that row.

Any fix?

  • Do you use the new Google Spreadsheets?
    – Jacob Jan
    Commented Mar 20, 2014 at 10:47
  • Hmm not sure :-) I guess I could migrate if needed.
    – Jonny
    Commented Mar 20, 2014 at 10:59

1 Answer 1


Best is to make a custom menu, via Google Apps Script. This will allow you activate things by row.


function onOpen() {
  var ss = SpreadsheetApp.getActive();
  var items = [{name: 'Magic', functionName: 'myMagic'}];
  ss.addMenu('Do Stuff', items);

function myMagic() {
  var ss = SpreadsheetApp.getActive(), aRow = ss.getActiveCell().getRow();
  var nDate = Utilities.formatDate(new Date(), "GMT-1", "dd-MM-yyyy");

Your magic needs to happen in the myMagic function.


I've prepared an example file for you: button vs. menu
You can run the code and see it in the file itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.