Search code examples
google-sheetsscriptinggoogle-sheets-formulagoogle-sheets-query

Google Sheets script that enables you to insert/write a word in a cell when clicked while assigned to a drawing (acting as a button)


I'm making a workout tracker that tracks my workout almost every day with a bit of odd rules in it. What I wanted to do is a button (with the use of a drawing and a script assigned to it) that inserts the word "skipped" whenever I click on it. I can't seem to find an answer to this.

Here is the link to a copy of my tracker: sample tracker

To summarize it up, I want to create a button that serves only (1) purpose, to insert the word "skipped" in a cell.

Can anybody help me on this?

Thanks in advance.


Solution

  • Based on the existing scirpt attached to your sample spreadsheet, you need to modify it as following:

    function Skipped() {
      SpreadsheetApp.getActiveSheet()
      .getActiveCell().setValue('SKIPPED');  
    }
    

    This will assign the value "SKIPPED" to the cell that it is active at the moment you click the button.

    Don't forget to assign the function Skipped to your button by clicking on the "three vertical dots" on the button, selecting Assign script and typing in the name of the function without the brackets() - Skipped.