Copies a range to another location or sheet.
class SpreadsheetApp method .copyTo()
SpreadsheetApp is the Apps Script service.
.copyTo() is the method name you will see after a dot in your code.
What it does
Why it's used
- Duplicate a template block to a new sheet or file.
- Back up a range before overwriting it with fresh data.
Common errors
- Forgetting parentheses on copyTo. Write SpreadsheetApp.copyTo(), not SpreadsheetApp.copyTo or copyTo by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').copyTo().
- Adding spaces where they do not belong. Write SpreadsheetApp.copyTo(), not SpreadsheetApp .copyTo(), SpreadsheetApp.copyTo (), or SpreadsheetApp . copyTo().
- Wrong capitalization. Use SpreadsheetApp and copyTo, not spreadsheetapp or copyto.
Snippets using this method
- Ultimate Prompt Writer and Prompt Rater
- Visicalc 2023 Design Walkthrough
- Visicalc 2023 Quick Walkthrough
- Twitter App Clone in a Google Sheet
- Reformat Pasted Cells Automatically
- Richard Asks: Copy Template Tab and Rename to Date Every Week
- Move Blank Rows
- Learn to Code in Google Sheets, For Programmers
- Now Do It Every Damn Day - Learn to Code in Google Sheets Part 5
- Move Entire Row when a Cell is changed to "Yes" - The $75,000 Google Script
- How to Trigger Macros Daily
- How To Duplicate a Tab and Move it to the End in Google Sheets
- CRM Automations
- ChatGPT Clone in Google Sheets Part 2
- Copy That, From One Sheet to Another - Learn to Code in Google Sheets Part 4
- Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
- Basic CRM - Add a Powerful Script To Move Row Based on Status
- Automate Move Blank Rows
- Automatically Backup a Spreadsheet
- Automate Google Sheets With Zero Experience
- Different Kinds of Automation
- Automated Project Management in Google Sheets
- Americano Tournament Template With Four Automations
Explore
Related methods
-
.activate()
Makes a sheet or range the active selection.
-
.getRange()
Returns a range of cells by A1 notation or row and column numbers.
-
.setValues()
Writes a 2D array of values into a range of cells.
-
.offset()
Returns a range shifted by a number of rows and columns.
-
.insertSheet()
Adds a new sheet tab to the spreadsheet.
More Apps Script
Better Sheets tutorials
Americano Tournament Template With Four Automations
Automated Project Management in Google Sheets
Automate Emails
Automate Google Sheets With Zero Experience
Automate Move Blank Rows
Automatically Backup a Spreadsheet
Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
Basic CRM - Add a Powerful Script To Move Row Based on Status
ChatGPT Clone in Google Sheets Part 2
CRM Automations
How To Duplicate a Tab and Move it to the End in Google Sheets
Learn to Code in Google Sheets, For Programmers
Move Blank Rows
Move Entire Row when a Cell is changed to "Yes" - The $75,000 Google Script
Now Do It Every Damn Day - Learn to Code in Google Sheets Part 5
Reformat Pasted Cells Automatically
Richard Asks: Copy Template Tab and Rename to Date Every Week
Ultimate Prompt Writer and Prompt Rater
Visicalc 2023 Design Walkthrough
Related blog posts
Written guides about SpreadsheetApp.copyTo().
How to reference a different Google Spreadsheet in Apps Script?
Transferring Data Between Cells in Different Spreadsheets
Read post →Automatic Weekly Backup of Google Sheets
How can we create backups of Google sheets every week or every day or every month?
Read post →What's Better Than Google Sheets?
Nothing is better than Google Sheets. You just need to learn more about the unlimited power of Google Sheets. Functions, Formulas, Apps Script and more.
Read post →