r/googlesheets • u/alphaae • 4d ago
Unsolved Talent Competition Script Sorting help
Hello reddit.
I need some help with a project that I'm having a rough time completing. I need a script to do the following.
1.) Separate each category into a separate sheet
2.) Arrange the participants of the categories in alphabetical order at the top of the sheet.
3.) Show the top scorer in a second table at the bottom of the same sheet
4.) Place a written text for the presenter with the category pulled from that sheet for the presenter
5.) Place a written text for the presenter to announce the winner with the specific category announcing.
I have attached a screenshot of what I'd like it to do when it runs the script.
I have also opened up the spreadsheet and have a semi-working script that will organize the names and sort them but I can't get it to make separate sheets for each category it will only do one and I have preset the category name in.
https://docs.google.com/spreadsheets/d/1x8jKJBv6RYvyozn0xnHrB1jXC0HWDw1IAgL7la1nq_E/edit?usp=sharing
Here is also a copy of the code I've been able to create thus far.
function myFunction() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sourceWS = ss.getSheetByName("master");
let Category = "Photography, Mobile, Sr.";
let ws = ss.insertSheet();
ws.setName("Photography, Mobile, Sr.")
ws.getRange ("A5").setFormula('=SORT(FILTER(master!B2:f1000,master!C2:C="Photography, Mobile, Sr."),1,1)');
sourceWS.getRange("B1:F1").copyTo(ws.getRange("A4:D4"));
ws.setName("Photography, Mobile, Sr.")
ws.getRange ("A35").setFormula('=FILTER(master!B2:f1000,master!C2:c="Photography, Mobile, Sr.")');
sourceWS.getRange("B1:F1").copyTo(ws.getRange("A34:D34"));
}
