Geo
Geo

Reputation: 11

Google Sheets (Hide/Unhide row with script)

I'm new to Google Sheets. I have a spreadsheet where I have one record per line. Everytime I finish entering a record I want it to unhide the row below it, could someone show me a simple script to do this? Also, I would want to clear all records and hide all but the first row in the record range, a bit help please.

Upvotes: 0

Views: 678

Answers (1)

Cooper
Cooper

Reputation: 64032

Try this:

function onEdit(e) {
  //e.source.toast('entry');
  const sh=e.range.getSheet();
  const hr=1;
  if(sh.getName()=='Sheet1' && e.range.rowStart>hr && e.range.columnStart==sh.getLastColumn()){
    sh.showRows(e.range.rowStart+1);
  }
}

Before:

enter image description here

After:

enter image description here

Upvotes: 1

Related Questions