Google-sheets – Automatically copy first 3 columns from one sheet to each new sheet in Google Sheets

google sheets

I'm having columns A, B and C filled with data in Sheet1. Those columns contains data that is static for each new sheet. Currently, I need to manually copy the first three columns to each new sheet I create.

How can I automate the process that each time I click on the + (Add Sheet), to have that columns copied?

UPDATE: I tried to implement a similar solution found here https://stackoverflow.com/questions/55269902/automatically-copy-data-between-google-sheets

Even though this seems like a good starting point, my lack of knowledge on this matter overcomes my efforts. I tried modifying this function a bit, but didn't get any results.

Best Answer

Here's a roadmap to implement this functionality yourself using a simple Google Apps Script Trigger.

Create a trigger onEdit(e) that iterates through all sheets, checking whether there are any empty ones (i.e. newly created). If it none are empty, job done. If it finds an empty one, it reads in columns A, B, C from your first sheet and sets the values of the empty sheet to those. Job done.

Alternatively, you can delete the empty sheet and copy the static sheet.

Yet another way of doing it is to create a new menu item (basically an add-on) that simply creates a new template with the right columns filled in when clicked.

Yes, you'll have to learn basic Apps Script for it, but it's nothing extraordinarily complicated. This should help you get started for how to read and write cells: https://stackoverflow.com/questions/11334296/google-sheet-script-set-cell-value.