0

any help for what I need to do below is greatly appreciated!

I have a main tab in Google Sheet with a list of employees name in Column A.

I'm adding, removing, and renaming cells in this column very often.

When I input new values into an empty cell in Column A, I want it to create a new tab, named after the value I input.

When I empty/delete a cell, I want it to delete the tab associated with it.

When I rename a cell, I want it to rename the tab associated with it as well.

Here's an example

Main tab:

    | Col A |
  1 |  Bob  |
  2 |  Bill |
  3 |  Abby |
  4 | Cathy |
  5 | Jill  |
  6 |       |
  7 |       |

Employee Tabs:

Bob, Bill, Abby, Cathy, Jill

Then, I delete row 5 (the whole row), and added 3 more names below Cathy:

    | Col A |
  1 |  Bob  |
  2 |  Bill |
  3 |  Abby |
  4 | Cathy |
  5 | Rosie |
  6 |  Jack |
  7 | Matt  |

Now I have the following Employee Tabs:

Bob, Bill, Abby, Cathy, Rosie, Jack, Matt

Then, Abby decided to change her name to Abs | Col A | 1 | Bob | 2 | Bill | 3 | Ab | 4 | Cathy | 5 | Rosie | 6 | Jack | 7 | Matt |

Now here are my Employee Tabs:

Bob, Bill, Ab, Cathy, Rosie, Jack, Matt
4

1 回答 1

0

创建、重命名和删除工作表/选项卡

function createTab() {
  SpreadsheetApp.getActive().insertSheet('sheetName');
}

function renameTab() {
  SpreadsheetApp.getActive().getSheetByName('currentname').setName('newName')
}

function deleteTab() {
  SpreadsheetApp.getActive().deleteSheet(SpreadsheetApp.getActive().getSheetByName('SheetName'));
}
于 2019-03-15T23:06:16.670 回答