looks like this is the code for HQ leaderboard not sure what is wrong, do not really have a lot of experince with scripts on google sheet. but can it be so simple as the user that made it, have to logged in on his or her google account for it to run. have noticed that it often are not updating in real time
iI do not have permission to run the script manually.
function updateCompletionCounts() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sourceSheet = ss.getSheetByName(“Low Quality BCs”);
const outputSheetName = “Leaderboard”;
let outputSheet = ss.getSheetByName(outputSheetName);
if (!outputSheet) {
outputSheet = ss.insertSheet(outputSheetName);
}
const data = sourceSheet.getDataRange().getValues();
if (data.length < 2) return;
const headers = data[0];
const proofreaderCol = headers.indexOf(“Proofreader”);
const statusCol = headers.indexOf(“Status”);
if (proofreaderCol === -1 || statusCol === -1) {
throw new Error(“Could not find ‘Proofreader’ or ‘Status’ column.”);
}
const counts = {};
for (let i = 1; i < data.length; i++) {
const name = data[i][proofreaderCol];
const status = data[i][statusCol];
if (
name &&
(status === "Complete" || status === "Complete (cut off)")
) {
counts[name] = (counts[name] || 0) + 1;
}
}
const sorted = Object.entries(counts)
.sort((a, b) => b[1] - a[1]);
outputSheet.clear();
// Header row
const headerRange = outputSheet.getRange(1, 1, 1, 3);
headerRange.setValues([[“Name”, “Cells”, “”]]);
headerRange.setFontWeight(“bold”);
headerRange.setBackground("#ffd966");
if (sorted.length > 0) {
outputSheet
.getRange(2, 1, sorted.length, 2)
.setValues(sorted);
}
// Add medals
const medals = [“
”, “
”, “
”];
for (let i = 0; i < Math.min(3, sorted.length); i++) {
outputSheet
.getRange(i + 2, 3)
.setValue(medals[i])
.setHorizontalAlignment(“center”);
}
// Remove empty extra columns (keep only 3)
const maxCols = outputSheet.getMaxColumns();
if (maxCols > 3) {
outputSheet.deleteColumns(4, maxCols - 3);
}
}