Saturday 31 August 2019

Clear cell content on Google Sheet edit

The following Google Apps Script is designed to clear the adjacent cell to the right of the one that has just been edited - so long as it is within the column we specify. It was developed as I was testing the available options for a Stock Inventory system where an item that was to be marked as back in stock would automatically clear an email timestamp in the adjacent cell (ready for the whole ordering process to start again).

We make use of the 'onEdit(e)' trigger to achieve this task which takes an 'event object' - e - that is passed to the function so we can determine which cell has been edited. This example focuses upon taking action on edits in column 2 only.
Screenshot of coloured columns to highlight actions
Screenshot of coloured columns to highlight actions

Clear cell content on Google Sheet edit.xlsx

2 comments:

  1. afternoon, I have been trying to get something in a cell I7 to clear when cell J7 is changed/input

    this would also be used for the below cells in each row

    I have found script to work from but it just doesn't seem to function. Is there something I am missing on this...?

    ReplyDelete
    Replies
    1. Hi

      does it do absolutely anything at all? This particular Function is designed to clear the 'adjacent cell' to the one that has been edited.

      It sounds like you have a specific cell that you want clearing, which means lines 23 to 28 need changing as they're set to only clear column 3.

      Kind regards
      Phil

      Delete