Create a new Sheet tab within an existing Google Sheet file and format a header row (font size, colour, alignment, etc) for appending data to.
The following Google Apps Script was developed as part of a larger tool for collating file information into a specifically formatted Google Sheet. As the tool was an Add-on I needed to setup the Google Sheet file in advance so that information could be later appended to it. This code:
- Checks if a particular named Sheet (tab) already exists within the Google Sheet file. If it does then it will delete the existing Sheet and create a brand new one.
- Reduce the overall number of columns within the Sheet.
- Insert 1 row of data to use as the Header row.
- Set the Header row font size, colour, weight (bold) and horizontal/vertical alignment.
- Set the Header row background colour, height and column widths.
Source: The Gift of Script: Create a new Sheet tab and format a header row
I use Google Apps Script to support staff and students in my job. I enjoy dabbling with creating tools to help with automation and I freely share my learning experiences on my blog, where I also have a number of useful Google Add-ons: www.pbainbridge.co.uk