1

I was hoping to find a script that does the following:

  • Takes data from a particular spreadsheet,
  • Duplicates that data to a new sheet as values only
  • in the second spreadsheet it creates a new sheet based on the month

A bit more information I am producing monthly reporting which has custom scripts and configures working in the background - however this data is "live" in that it will change based on the current month.

Therefore I either need to print that data to a file per month i.e., each tab gets a month Jan, Feb, March etc or each tab can be set up in the receiving file to pull the data as a snapshot on a particular day via a trigger.

Basically an ImportData snapshot of a target sheet in another Spreadsheet file.

1

I wasn't logged in when I asked this question, but here is the script I am using to achieve this if anyone wants to use it.

function CopySheet() {

var ss = SpreadsheetApp.getActiveSpreadsheet();
var data = ss.getSheetByName("sheet1").getDataRange().getValues()
var newSh = ss.insertSheet(ss.getSheets()).setName(ss.getSheetByName("sheet1").getRange(4,1).getDisplayValue());
newSh.getRange(1,1, data.length, data[0].length).setValues(data);
}

I found the script somewhere around here or Google forums, so not claiming it. The only modification I made was to grab the value from a cell to name the sheet with, the original script had it naming by date and time - which was no good for me as I would like to be able to reference the new sheet in other reports.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.