Reputation: 1
I Am wondering if anyone can help.
I have been making a collection log sheet in google sheets and i want to only make a copy of 1 of the work sheets at the end of each month.
for exaple i want this worksheet tab in google sheets called collected orders to be copyed and then the sheet to be cleared of data arfter it had been copyed to the google drive
https://i.sstatic.net/ASyyH.png
Upvotes: 0
Views: 60
Reputation: 183
The Apps Script reference documentation is your friend https://developers.google.com/apps-script/reference/spreadsheet. The following code may or may not answer your question as it isn't completely clear what your actual workflow is. What the code below will do is;
Delete the cells specified by that range of data
function copySheetDeleteData() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var mySheet = ss.getSheetByName("Completed Orders");
var myNewSheet = mySheet.copyTo(ss);
var copiedData = myNewSheet.getDataRange()
copiedData.deleteCells(SpreadsheetApp.Dimension.ROWS)
}
When I read your question I think;
Upvotes: 1