Situation:
I have a spreadsheet with 10 worksheets and 15 users logging in and modifying it. I want to copy just 6 sheet from other spreadsheet.
Script Function Needed:
The script should be copy sheet to another spreadsheet specific.
1) Source = XXXXXX I want to copy from Source only the sheets1,2,3,4,5,6,7,8 to target. Target = YYYYY
Note: The Target already have the sheet1,2,3,4,5,6,7,8. I needs update that Target spreadsheet because I use that to make Reports. I can not use the surce because this report are confidential.
2) The script needs to be run from the target.
Problem:
I read a lot of forum but anyone provide a generic script about "How to Copy Sheets to anothers Sheet". All those script are very complex an I'm newbe with this.
Test Case:
N/A
I thinks is a simple copy of sheet from one spreadsheet to another but I needs to do this in oneshot actually I am doing it manually but I have issue the system change the sheet name to Copy of XXXXX but my Reports are configured to use a specific name, that why I needs make this possible. I thinks this script will help to many people.
Thanks in Advance.
EDIT: 14/06/2013
Hi,
Please could you help me to tunning this script to work more effective.
function UpdateData() {
var source = SpreadsheetApp.openById('YYYYYY');
var sheet8 = source.getSheets()[8];
var sheet7 = source.getSheets()[7];
var sheet6 = source.getSheets()[6];
var sheet5 = source.getSheets()[5];
var sheet4 = source.getSheets()[4];
var sheet3 = source.getSheets()[3];
var sheet2 = source.getSheets()[2];
var sheet1 = source.getSheets()[1];
var destination = SpreadsheetApp.openById('ZZZZZZ');
sheet8.copyTo(destination).setName('Sheet8');
sheet7.copyTo(destination).setName('Sheet7');
Utilities.sleep(100);
sheet6.copyTo(destination).setName('Sheet6');
sheet5.copyTo(destination).setName('Sheet5');
Utilities.sleep(100);
sheet4.copyTo(destination).setName('Shee4');
sheet3.copyTo(destination).setName('Shee3');
Utilities.sleep(100);
sheet2.copyTo(destination).setName('Shee2');
sheet1.copyTo(destination).setName('Shee1');
SpreadsheetApp.flush();
}