Ajay
Ajay

Reputation: 31

Duplicating a google spreadsheet without google drive access via API

I want to duplicate spreadsheets, basically copy of templates to new spreadsheets via google Sheets APIs. There is a copyTo function that can copy only a specific sheet from a spreadsheet. But there seems to be no option to copy the whole spreadsheet. I don't want to access customer google drive for this duplicate need. Is there any other option to make a copy of the whole google spreadsheet to a new spreadsheet without the need of accessing google drive (or Drive API)?

Upvotes: 0

Views: 118

Answers (1)

ziganotschka
ziganotschka

Reputation: 26796

You use the method copy(name) for spreadsheets

Sample:

var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.copy("Copy of " + ss.getName());

Upvotes: 1

Related Questions