Andrew Smith
Andrew Smith

Reputation: 1

Script for copying format

I am using a script made by someone else that helps pushing out individual rubrics out to students. The script copies the formatting and conditional formatting to my spreadsheet but when I send out to each student, the formatting is no longer there. Can someone help me with this?

//Copy from teacher spreadsheet to student spreadsheet
var newRange = newSheet.getSheetByName('rubric').getRange("A1:P103");//copies the range over
newRange.setValues(getTabData);

Upvotes: 0

Views: 2640

Answers (1)

Brian
Brian

Reputation: 4354

You're only setting the values, not the formatting data.

You could use the copyTo() method on the range to get data and formatting. All it requires is a destination range to insert the data. Without seeing any of your code, it's something like this:

var studentSheet = stuSheet.getRange("A1:P103");
var teacherSheet = newSheet.getSheetByName('rubric').getRange("A1:P103");

teacherSheet.copyTo(studentSheet);

Upvotes: 4

Related Questions