Skip to content
Advertisement

Split One Google Sheet into Multiple Sheets based on Column Value – Replace Duplicate Sheets

This is getting to be above my level of knowledge and I was hoping for assistance. The script below works with some limits. This script checks to see if a region tab exists, if it doesn’t, the regional data from the source worksheet is copied to a new tab by the name of that region. Region is column 24 on the source worksheet, the data starts on row 3 and the header is Row 2.

If the region tab already exists I would like for it to be deleted recreated or repopulated with current data instead of being skipped over.

JavaScript

Advertisement

Answer

Try it this way

JavaScript

Explanation:

Loop through all tabs, and if the tab already exists, delete it via deleteSheet before creating it again, as you are doing with the non-existent ones..

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement