Google Sheets copyTo() function failing with server error

Help! I’m stuck with a frustrating issue in the new Google Sheets.

I’m trying to use the sheet.copyTo() function, but it’s not working at all. Every time I run it, I get the same error message: “A server error has occurred”. I’ve tried a bunch of things to fix it:

  • Converting the source sheet to the new format
  • Using CSV files instead
  • Double-checking my code

Nothing seems to work! The weird thing is, when I use the exact same code and sources in the old Google Sheets, it works perfectly. I’m totally stumped.

Has anyone else run into this problem? Any ideas on how to get copyTo() working in the new Sheets? I’d really appreciate any help or suggestions!

I encountered this issue recently as well. It seems to be a persistent bug in the new Google Sheets. One workaround I found effective was using the SpreadsheetApp.open() method to open the source spreadsheet, then using getSheets()[0].copyTo(destination) instead of the direct copyTo() function. This approach bypasses some of the server-side issues.

Another option is to use the advanced Sheets API if you’re comfortable with it. It provides more robust methods for sheet manipulation and often works when built-in functions fail.

If all else fails, consider logging an issue with Google Support. They might be able to provide more insight or escalate the problem if it’s a widespread issue with the new Sheets.

hey there, ive had similar issues w/ copyTo() lately. have u tried clearing ur browser cache? sometimes that fixes weird server errors. also, double-check ur script permissions - make sure it has access to both source & destination sheets. if none of that works, maybe try the driveapp.getFileById() method as a workaround?

I’ve been dealing with this exact problem for weeks now. It’s incredibly frustrating! One thing that worked for me was breaking down the copyTo() operation into smaller steps. Instead of copying the entire sheet at once, I looped through the rows and columns, copying data cell by cell. It’s not as elegant or efficient, but it got the job done when everything else failed.

Another trick that sometimes helps is to add a small delay between operations. I used Utilities.sleep(1000) before the copyTo() call, which seemed to reduce server errors.

If you’re open to alternatives, consider using the Sheets API directly. It’s a bit more complex to set up, but it gives you finer control and tends to be more reliable for these kinds of operations.

Hang in there – Google will hopefully address this soon!