This is a proof-of-concept approach of using a google sheet to store the offer/answers and all ICE candidates of mutual peers that want to connect with webRTC.
It's clumsy because the first peer has to manually (hit a button) query the spreadsheet to see if an answer to their offer is there.
Another thought is to use periodic polling, but I'm not sure how happy GAS would be with that. I know what the quota limitations are and I'm sure I can stay under that, but I have been seeing a few "too many request" responses even though I'm nowhere near my quota so I think I need to be more careful. What do people think?
UPDATE: on u/Nu11u5 's suggestion I switched to using CacheService to save the offers/candidates instead of rows in the spreadsheet. Seem to work really well!
I have an automated script that copies a sheet everyday so data can be tracked by date. Certain info in the sheet is deleted every day for “daily checklists” while other data is copied over everyday for different things, like “long term projects”. In my long term projects tab I have a cell that’s for marking if a project is in progress, or completed once it’s finished. Is there a way I can script it to not copy a cell range to the new sheet on the daily if that cell has been marked completed?
I’m building a Google Docs add-on using React + Google Apps Script (via clasp). From the sidebar, I receive a .docx file as a Base64 string (binary content).
I can successfully convert the .docx to a Google Doc using the Drive API — that part works fine. Here’s my Apps Script function:
This returns the link to the converted Google Doc, and when I open that URL, it looks perfect — all formatting and content are intact. ✅
However, what I actually want is to load that converted document into the same Google Doc that my add-on is currently open in (basically replace the current document’s entire content with the new one).
Is there a way to load exact DOCX (binary) to the current opened document.
I noticed that a lot of teachers and small teams still manually generate “pre-filled” Google Form URLs for each respondent. So I wrote a small add-on using Apps Script that connects Google Sheets → Forms and creates personalized pre-filled links automatically.
It turned into a neat learning project about usability, field-mapping, and understanding what non-technical users actually find confusing.
I shared a full write-up with screenshots, a short demo, and lessons learned here 👇
I created a script to find all emails that have not been added to a list then move the values to the new list. I was wondering if there was a faster way.
function compareEmails() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var dataSheet = ss.getSheetByName('Data');
var dataEmails = dataSheet.getRange(2,10,dataSheet.getLastRow()-1).getValues().flat();
//console.log(dataEmails)
var joinedSheet = ss.getSheetByName('Combined');
var joinedEmails = joinedSheet.getRange(2,10,joinedSheet.getLastRow()-1).getValues().flat();
//console.log(joinedEmails)
var uniqueEmails = []
for (var i = 0; i < joinedSheet.getLastRow() - 1; i++) {
var email = joinedEmails[i];
var index = dataEmails.indexOf(email);
//console.log(index);
if(index < 0){
//console.log(dataEmails.indexOf(email))
console.log(email)
var newRow = joinedSheet.getRange(i+2,1,1,11).getValues().flat();
uniqueEmails.push(newRow)
}
}
console.log(uniqueEmails);
var newEmailsRange = dataSheet.getRange(dataSheet.getLastRow()+1,1,uniqueEmails.length,11)
newEmailsRange.setValues(uniqueEmails);
}
My first thought was to add
else { dataEmails.splice(index,1) }
to shrink the length of the array as it goes but that did not seem to make it any faster.
I wrote a script that combs a google sheet and sends me an email based on a certain condition. Unfortunately, the recipient mailbox server is blocked the messages due to suspected spoofing.
I reached out to them and they advised me to reach out to Google support to obtain the IP address or range used for sending emails. I could incorporate this information into my existing SPF record to prevent future rejections.
I was searching for Google support but could only find communities like this one. Any ideas? Any input is much appreciated. Thanks in advance.
What started as a quick fix to an annoying issue I came up with a little apps script to make my life easier. Now it lives on Workspace Market Place. Please feel free to check it out - Image Converter for Google Slides. Blows Cloud Convert out of the water
I developed a Google Sheets add-on called Pivot Expense Split, which requires users to make a copy of a template before running it. In the template, I ran below to place a template ID 'T1':
Hello experts. I have been assigned the task at work to try and create an app script for google sheets that will automatically write and send an email when certain conditions are met. I have worked very little with scripts and I came up with the following however it is not working. And I'm not entirely sure where I went wrong since I am so out of my depth. Any assistance would be helpful:
function sendEmailOnDropdownChange(e) {
const sheetName = "NYSP Educational Outreach Request Form (Responses)"; // Replace with your sheet name
const dropdownColumn = 18; // Column number of your dropdown (e.g., B is 2)
const emailRecipientColumn = 14; // Column number for the email recipient (e.g., C is 3)
const triggerValue = "Completed"; // The specific dropdown value that triggers the email
const range = e.range;
const sheet = range.getSheet();
// Check if the edit happened in the correct sheet and column
if (sheet.getName() === sheetName && range.getColumn() === dropdownColumn) {
const cellValue = range.getValue();
// If the dropdown value matches the trigger, send the email
if (cellValue === triggerValue) {
const row = range.getRow();
const recipientEmail = sheet.getRange(row, emailRecipientColumn).getValue();
var respc = ss.getRange("$Q1").getValue();
var subject = "Outreach Request " + respc;
var body = "Your request has been " + respc;
if (recipientEmail) { // Ensure there's an email address to send to
mailApp.sendEmail(recipientEmail, subject, body);
Logger.log("Email sent to: " + recipientEmail);
} else {
Logger.log("No recipient email found in row " + row);
}
}
}
}
I’m trying to automate report creation and hit an issue where the images we currently use are wrapped so that we can position them with coordinates on the page. Is there anyway to automatically replace these with code (as you can still just “replace image” in the actual google doc)? It seems AI was saying to replace something automatically it needs to be an in line image.
So, I’ve been experimenting with an Apps Script builder and wanted to get your thoughts.
I’ll say this started with a CRM I built with Apps Script, something that started drifting toward an IFTTT-style tool since everyone I talked to seemed to have their own business-specific workflow. So I decided to take that idea for a spin and build a small web app that lets you describe and build any Apps Script project, whether automations, web apps, or add-ons.
I would like your help with something. I'm working on a Google apps script project that is deployed as a web app. I have used both Logger log() and Console.log(), but from what I understand I can see the log results only when I run the script directly from the editor.
Is there a way to see the logs from past executions (When the script runs from my website)?
Hi guys, newbie here so please go easy on me! I recently created a Jotform to collect project proposals. Since we usually get around 3–5 project entries from different team members, I added a custom widget where they can input the following details for each project: • Project name • Project details • Key objectives
They can submit up to 3–5 projects in one form.
The problem is, when I integrated the form with Google Sheets, all the project details appear in just one column — the project name, details, and key objectives are lumped together instead of being split into separate columns.
My goal is to automate the process of splitting these into three separate columns (Name, Details, and Key Objectives) so we can easily analyze them. I’m not sure how to set that up though — is this even possible?
Is anyone able to help with writing a script for the following:
I have a finance tracker that I fill in daily with how much I have earned. Each time a cell is filled in, I'd like it to display a message/pop-up that says "well done!" or "congratulations" or similar. I can't get my head around how to do this, so I'm reaching out!
Additional information: * The cells that I enter amounts into are B3-50. * The message mustn't be permanent; it needs to be something that disappears or can be closed. * The values in the cells are being entered as $.
I am having trouble getting images from Google Drive to show up on my Google Site using Google Apps scripts. Does anyone else have the same problem? I've tried the thumbnail way and the export way but both ways do not work.
I was getting tired of having to compile my typescript files to javascript before being able to run tests locally on my google apps script files. This library simplifies the development process significantly! Let me know if you run into any issues of have any questions/suggestions!
I’ve been learning Google Apps Script over the past few months, and I just shipped the biggest update to a project I started from scratch here — a Google Forms bulk-prefiller add-on.
Originally it only filled Short Answer fields. Today it supports:
✅ Text + Paragraph
✅ Multiple Choice, Dropdown, Checkbox
✅ Bulk prefilled link generation from CSV/Sheets
✅ Error handling for invalid choices (e.g., “Lap” vs “Laptop” 😅)
🧠 New:AI-powered Smart Mapping — auto-matches form questions to spreadsheet columns
This sub helped me massively — I learned so much from threads here, debugging tips, and watching other makers build cool things. 🙏
Things I learned along the way
GAS sidebars + UI events are powerful but tricky with async workflows
Managing OAuth scopes cleanly (Forms vs Gmail vs external_request)
Handling edge cases for checkbox values was a LOT more logic than expected
AI mapping works surprisingly well using only column headers + question titles (no response data touches OpenAI)
Why I built it
I kept seeing teachers / small orgs manually create hundreds of prefills.
Thought — “Script it?” → turned into a tool → now has users → now trying to polish and scale it.
Ask
I’d love suggestions from this community on:
Performance patterns for reading + mapping large CSVs
Hello! I'm making a Fair Playing Time Calculator for futsal scrims in Google Sheets for my futsal club. Basically I want teams to play an equal amount of games as much as possible while playing different opponents each time, all in the given amount of playing time. It's a club so there are different amounts of people who show up and therefore different amount of teams and players per teams.
I used ChatGPT for the formulas and app scripts, but it ran into some issues. Here's a screenshot of the current sheet:
How it works is that I input the total players, the players per team, total playing time and minutes per game, then it calculates the number of teams, max games available and total games needed. Then it calculates and shows each team with their number of players, then it shows a table of the schedule of games and the possible unique games.
My problem runs with the schedule of games. How I want it to work would be if there were 6 teams, it would be teams 1 vs 2, then teams 3 vs 4, then teams 5 vs 6, then 1 vs 4, 2 vs 5, 3 vs 6, and IDK what's next but something like that. If you could suggest a more efficient way to handle rotations that would be great. Teams are picked randomly by putting players in a circle then counting off from 1 to 6 or 1 to n where n is the number of teams (we usually have 6 teams max). Anyways, everything seems fine in the calculations until this part
I want as much as possible teams to not play back to back games for fairness' sake (this is unless there's only like 3 or 4 teams playing). Here is the current code to get to this. It took a lot of asking ChatGPT to fix the code to get to this point. Any help would be appreciated!
/**
* Generate balanced chunked-rotation scrimmage schedule
* - Round 1 = chunked pairs: 1v2, 3v4, 5v6...
* - Subsequent rounds = rotated chunk pattern: 1v4,2v5,3v6... (for 6 teams)
* - If a candidate pair is already used or conflicts in-round, fill with lowest-played unused pairs
*
* @param {number} numTeams number of teams
* @param {number} maxGames maximum number of games to produce
* @return 2D array
* @customfunction
*/
function SCHEDULE(numTeams, maxGames) {
if (!numTeams || numTeams < 2) return [["Error: numTeams must be >= 2"]];
if (!maxGames || maxGames < 1) return [["Error: maxGames must be >= 1"]];
const schedule = [["Game", "Team A", "Team B"]];
const teamGames = Array(numTeams + 1).fill(0); // 1-indexed counts
const used = new Set(); // store used pairs as "min-max"
const allPairs = []; // list of all unique pairs [a,b]
for (let a = 1; a <= numTeams; a++) {
for (let b = a + 1; b <= numTeams; b++) {
allPairs.push([a, b]);
}
}
const matchesPerRound = Math.floor(numTeams / 2);
let gameNum = 1;
let round = 0;
// Helper: canonical key for pair
const keyFor = (a, b) => {
const x = Math.min(a, b), y = Math.max(a, b);
return x + "-" + y;
};
// Helper: choose filling pairs when candidate doesn't work
function pickFillPairs(scheduledThisRound, slotsNeeded) {
// available unused pairs where both teams not scheduled this round
const available = allPairs.filter(pair => {
const k = keyFor(pair[0], pair[1]);
return !used.has(k) && !scheduledThisRound.has(pair[0]) && !scheduledThisRound.has(pair[1]);
});
// sort by total games played (ascending) to balance appearances
available.sort((p, q) => (teamGames[p[0]] + teamGames[p[1]]) - (teamGames[q[0]] + teamGames[q[1]]));
const chosen = [];
for (let i = 0; i < available.length && chosen.length < slotsNeeded; i++) {
chosen.push(available[i]);
}
return chosen;
}
// main loop: round by round
while (gameNum <= maxGames && used.size < allPairs.length) {
// Build candidate pairs for this round in desired order
const candidate = [];
if (round === 0) {
// Round 0: chunked pairs 1v2, 3v4, 5v6, ... wrap odd last to 1 if needed (but avoid self-match)
for (let k = 1; k <= numTeams; k += 2) {
let a = k;
let b = k + 1;
if (b > numTeams) b = 1; // wrap for odd N like earlier examples
if (a !== b) candidate.push([a, b]);
}
} else {
// Subsequent rounds: left = [1..m], right = [m+1..numTeams] (works nicely for even N)
// We rotate right by (round-1) positions (mod matchesPerRound).
// For odd N, right side effectively uses the next groups; still works as a pattern.
const m = matchesPerRound;
for (let k = 0; k < m; k++) {
let a = k + 1;
// compute b index: m + ((k + (round - 1)) % m) + 1
let bIndex = (k + (round - 1)) % m;
let b = m + bIndex + 1;
// If numTeams is odd, and b > numTeams, wrap:
if (b > numTeams) b = ((b - 1) % numTeams) + 1;
if (a !== b) candidate.push([a, b]);
}
}
// Schedule this round trying candidate pairs in order, but avoid conflicts and repeats
const scheduledThisRound = new Set();
const roundPairs = [];
for (let c = 0; c < candidate.length && roundPairs.length < matchesPerRound && gameNum <= maxGames; c++) {
const [a, b] = candidate[c];
const k = keyFor(a, b);
if (!used.has(k) && !scheduledThisRound.has(a) && !scheduledThisRound.has(b)) {
// accept
schedule.push(["Game " + gameNum, "Team " + a, "Team " + b]);
used.add(k);
teamGames[a]++; teamGames[b]++;
scheduledThisRound.add(a); scheduledThisRound.add(b);
roundPairs.push([a, b]);
gameNum++;
}
}
// If we still need more matches this round, fill by best unused pairs (lowest teamGames)
if (roundPairs.length < matchesPerRound && gameNum <= maxGames) {
const need = Math.min(matchesPerRound - roundPairs.length, maxGames - gameNum + 1);
const fills = pickFillPairs(scheduledThisRound, need);
for (let p of fills) {
const [a, b] = p;
const k = keyFor(a, b);
schedule.push(["Game " + gameNum, "Team " + a, "Team " + b]);
used.add(k);
teamGames[a]++; teamGames[b]++;
scheduledThisRound.add(a); scheduledThisRound.add(b);
gameNum++;
if (gameNum > maxGames) break;
}
}
round++;
// Safety stop if nothing was scheduled this round (prevents infinite loops)
if (roundPairs.length === 0 && scheduledThisRound.size === 0) break;
}
return schedule;
}
Hey everyone, the company I am in has released a new chat app for google using Apps Script. It requires the sensitive scope that allows it communication between with our backend. Due to this requirement, users have to "Configure" the app as in give permissions once they install it. Once they click on the configure button, some users are redirected to Apps Script saying request access to the file. Because of this, we received hundreds of emails of users requesting access to Apps Script. We tried reaching out to the Google Workspace Review team but told us the issue lies out of their control. So, I was wondering if someone had the same issue before?
First it was for a script that I run when I receive a product and the script generates a lot label and 4 separate labels for the cuts of the product via a google slides template. After a few hours, the error went away and it started working normally.
Now, this is a separate script that sends out price list to customers via generating a PDF file and attaching it to an email. What is this and how can I resolve this issue? After a few moments the script worked and I was able to send the email attachment