r/GoogleAppsScript • • May 10 '20

Question Hello. I wrote a script five years ago, it's essential to my business (teaching & tutoring), I use it several times a week, and it has always sucked because I don't program. Can you help me with some things?

8 Upvotes

I use it in Google Docs. For reference, an abridged version is at the bottom of this post. The real version is 1,000 lines long; the deleted part consists entirely of different permutations of the "replaceText" function.

Here are my questions/requests:

  1. Currently, to run this on a document, I need to paste the document ID into fixFile("") and then I run the function from within the script. Is it possible to have this script appear in the add-ons menu for ALL my docs so I can just run it from within the doc?

  2. Since replaceText is case-sensitive, currently I must use replaceText twice for each word: I write out the same string (i.e. the first string, left half of replaceText) in lowercase and uppercase. Is there a way to make the input for replaceText not be case sensitive?

  3. Also, is there a way to make the first half (left half) tolerate symbols, like parentheses, slashes, and quotation marks?

  4. When I use the 1,000-line version, sometimes the script times out!! (My documents are very long; they approach the 1.5M character limit.) Is there a better way to write the script to avoid that?

  5. Is there a way to remove all the bookmarks from a document? UPDATE: solved this myself!

  6. Can I run replaceText with wildcards, so for example: A*C gets replaced with ZYX, regardless what * is?

Thank you.

function runMe()
{
fixFile("")
}  

function fixFile(myFileID)
{
var myFile = DocumentApp.openById(myFileID)

var paras = myFile.getParagraphs()
var i
var style = {}
style[DocumentApp.Attribute.FONT_FAMILY] = 'Times New Roman'

for (i=0; i<paras.length; ++i) 
{
paras[i].setSpacingAfter(0)
paras[i].setSpacingBefore(0)
paras[i].setAttributes(style)
}

myFile.replaceText("limited liability company", "LLC")
myFile.replaceText("Limited Liability Company", "LLC")
myFile.replaceText("government", "govt")
myFile.replaceText("Government", "govt")
}

r/GoogleAppsScript • • May 07 '20

Guide Firefast - Firebase SDK for Apps Script V8 Runtime

Thumbnail
formfacade.com
8 Upvotes

r/GoogleAppsScript • • Apr 13 '20

Guide I've created this Google Apps Script for Google Sheets--basically copy the contents of all tabs and consolidate them in one tab. Feedback appreciated! :)

Thumbnail
claracommutes.com
8 Upvotes

r/GoogleAppsScript • • Nov 22 '19

With Google Cloud Print shutting down, how will we print from Google Apps Script?

8 Upvotes

Google reported today that they're planning on shutting down Google Cloud Print at the end of 2020.

Is there another way to print from Google Apps Script?


r/GoogleAppsScript • • Nov 12 '19

Would you good people tear apart my Google Apps Script tutorial on making a sidebar app?

8 Upvotes

Gearing up to do some apps scripting work I couldn't find much in the way of best practices. Turned out that there's not a whole lot I could find in one place, so I tried to do it here. Could you tell me what doesn't work about it? Google Apps Script Tutorial: Creating Time Tracker, a Spreadsheet sidebar app

Thanks kindly.


r/GoogleAppsScript • • Oct 30 '19

Use Apps Script to optimize your trick-or-treating route

8 Upvotes

The classic Halloween dilemma: how to visit as many homes as possible, making sure to hit the houses that give out full size candy bars. Google Sheets +Apps Script to the rescue! Simply enter a few addresses and it will calculate the optimal path.

https://docs.google.com/spreadsheets/d/1O5u3fqffsJD7ZmmsJsDHJyyZrJ0NT3ftDH39eZxeb2Y/edit#gid=0


r/GoogleAppsScript • • Oct 27 '26

Question 10 project managers, each managing 10 to 15 customer onboarding projects

7 Upvotes

Question: I have 10 project managers, each managing 10 to 15 customer onboarding projects. Each project includes milestones such as kickoff, eligibility, marketing, billing, reporting, testing, and go-live. Many tasks can happen in parallel.

Current process: Each project manager maintains a separate Google Sheets project plan, updates dates, and sends weekly client updates. Key milestones are manually entered into Salesforce for leadership reporting across approximately 150 projects. This creates duplicate work, and projects can fall behind without being flagged automatically.

My goal: Replace the 150 spreadsheets with one centralized application where project managers can select a client, view and update its project plan, track milestones and dependencies, and generate a client-facing plan.

Initial thoughts: Use Google Apps Script to build the interface and Salesforce as the single source of truth for milestones. I may need a separate database for the detailed tasks associated with each milestone, but I haven’t determined the best approach for managing those records.
A project manager would log in, select a client from a dropdown, and see the existing project plan, including due dates, completion dates, and notes. They could then export a client-facing version to share with the customer.

Key question: Is Apps Script the right tool for this? Am I missing something critical?

There are many tools available, but I would prefer to stay within the Google ecosystem for cost, security, and ease of management since we already use Google Workspace.


r/GoogleAppsScript • • Sep 12 '26

Guide Gmail-Housekeeper - Automated Gmail housekeeping and spam management using Google Apps Script, with rule-based filtering, safe cleanup, and detailed execution logging.

7 Upvotes

https://github.com/crosenblum/Gmail-Housekeeper

So what this does, it only touches two folders, the trash and spam.

It goes thru every spam email, checks email headers to indicate if the email is fishy, it also checks if each email from address is in your contacts, and also checks if each email has a label attached.

If the email headers indicate the email itself is very fishy, highly likely spam, and its not in your contacts and its not labelled in any way than it gets permanently deleted.

If an email is from someone in your contacts list or has a label associated with it, then it gets moved to your Spam folder.

Any email in your Spam folder older than 7 days gets deleted.

Now this works for me, it may not work for you.

There may be better ideas for strategies, and I am open to hearing from anyone who has a better or different idea.


r/GoogleAppsScript • • Aug 01 '26

Question How big is the system you created in apps scripts?

7 Upvotes

I'd like to take a few doubts before I venture to do things that he's not ideal. I will do a brief questionnaire:

  1. How many active users simultaneously have your largest GAS system had?

  2. How many thousands of records did the spreadsheet have? How many tabs?

  3. How do you read the data from the spreadsheet? Do they take everything and work with them in memory or do they do any paging strategies?

  4. Have you ever tried using it as if the spreadsheet was a relational database and the tabs were the tables? Did you find it difficult?


r/GoogleAppsScript • • Jul 27 '26

Guide Data Type Conversion from Apps Script to Google Sheets when using setValue()

7 Upvotes

This might be obvious to others but has tripped me up for years, so I finally decided to sit down and test all cases to get clarity on it.

The gist: The data types in Apps Script are irrelevant. Every input for setValue() is treated as if the user on the keyboard typed it in, hence resulting value in Google Sheets is determined by cell number format. The only exception to this is date objects.

Rules:

  1. setValue("") makes the cell in Google Sheets a true blank, unlike when a formula in Google Sheets returns "", which is treated as text and ISBLANK() returns false.

  2. setValue(string | number | boolean) these types have no special meaning, and all are treated as if the user typed the value in the cell in Google Sheets.

  3. setValue(null | undefined) both of these are treated same as an empty string ("").

  4. setValue(date object) always converted to Google Sheets timezone and then pasted as a Date, regardless of the cell number format in Google Sheets

Counterintuitive Examples:

Apps Script data typeValue passedCell number formatResult in Google Sheets
string""Plain TextBlank Cell
number1234Plain TextText "1234"
string"1234"AutomaticNumber 1234
booleantruePlain TextText "true"
string"true"AutomaticLogical TRUE
string"1/1/1"AutomaticDate 1/1/2001
string"1/1/1"Plain TextText "1/1/1"
date object1 Jan 2001 05:00:00 in UTCAutomaticDate 1/1/2001 00:00:00 (if Google Sheets timezone set to EST)
date object1 Jan 2001 05:00:00 in UTCPlain TextDate 1/1/2001 00:00:00 (if Google Sheets timezone set to EST)
date object1 Jan 2001 05:00:00 in UTCTimeTime 12:00:00 AM (if Google Sheets timezone set to EST)
date object1 Jan 2001 05:00:00 in UTCDurationDuration 885408:00:00 (hours since spreadsheet epoch date)

Note: Time & Duration are just special display formats for 'Date and time', the underlying value value remains the same. (Like Scientific and Accounting, for example, are different display formats for Number)

PS: Let me know if I got something wrong or if you have any questions!


r/GoogleAppsScript • • Jul 25 '26

Question Linking a professional email to Google Script + sheet

7 Upvotes

Hi, I've built an email delivery system for my business and everything is fine, but the problem is that it's being sent from my Gmail account and I want it to be sent from my professional email (namecheap private email).

I don’t want my professional email to simply appear as the sender address visually. I want the emails to actually be sent from it, so that I can find the emails I sent in the email account’s “Sent” folder.

The system is excellent and perfectly set up for me, but at the same time, I must use my professional email, so giving up either one of them is simply not an option. Please give me any possible solution, even if it’s a workaround—I can handle the technical side of it.

Thank you!

UPDATE: The only solution I found that worked for me was using a Python script that runs a Google Sheets script and sends the emails through my professional email address. I can even find them in the Sent folder.

Now, all I have to do is click a .bat file to run the system and send the emails through my Namecheap email.


r/GoogleAppsScript • • Jul 02 '26

Question Appscript project verifications

7 Upvotes

Is verifying an appscript project taking longer than usual? In the past you could get an app verified in under a week, the longest I waited was 11 days, i have an app that has taken over a month and all the reviewer does is to send some template message complaining about stuff my video already addresses. Are those in the Trust and Safety team audited at all to ensure they are doing the right thing? It is now so frustrating, it is like they dont even know what they are about. Am I the only one experiencing this now? I thought the process will be faster consideting AI does some of the work now.


r/GoogleAppsScript • • May 15 '26

Resolved Used Google Apps Script to automate real-time jewelry pricing updates

Thumbnail
gallery
7 Upvotes

r/GoogleAppsScript • • May 03 '26

Question Web App asking other uses for Permissions

7 Upvotes

I have a Google Apps Script web app that generates Amazon advertising reports. The script uses executeAs: USER_DEPLOYING with access: ANYONE_ANONYMOUS in appsscript.json, which should allow anyone with the link to access it without needing to sign in or authorize anything. However, every time a new user opens the app, they are prompted with a Google permissions/authorization screen asking them to grant access. I have tried the following to fix this: setting executeAs to USER_DEPLOYING (not User Accessing), setting access to ANYONE_ANONYMOUS, creating a completely fresh new deployment (not updating an existing one), and verifying the appsscript.json reflects these settings correctly. Despite all of this, new users are still being asked for permission every time they open the app. The script uses Drive API v2 as an advanced service, which is enabled in the project. Has anyone encountered this before and found a working solution? Is there something specific about using advanced services like Drive API that forces the OAuth screen regardless of the deployment settings?


r/GoogleAppsScript • • Apr 28 '26

Question Google App script down?

7 Upvotes

Hi, I am not able to create any kind of deployment, I've been facing issues while creating any deployment in the google sheet linked app script, It just opens the error dialogue.


r/GoogleAppsScript • • Mar 17 '26

Question RFID Tag Warehouse Scanning

7 Upvotes

Hello Wonderful People!

Quick Background: Our industry requires RFID AND Barcode labels to be attached to all inventory, but our organization has yet to start using RFID scanning to capture data (still using the 2D barcode). We use google sheets to generate CSV files required by the same regulations as the RFID labels; therefore our most basic inventory is in sheets. Our inventory is spread across multiple rooms within the same vertically stacked infrastructure; audits and locating stray inventory is becoming a labor sink.

Goal: I am hoping to leverage the increasingly affordable RFID scanning guns, but am caught up on the cost of software sales reps keep pointing to. Because RFID scanning picks up the same tag multiple times, and can occasionally read a tag incorrectly, these software solutions "clean" this data and prepare it for integration into other systems.

Limited Use Requirements: Inventory audits by location, Creating/cleaning lists of scanned tags to be integrated with existing google sheet (more or less: adding lists at last row)

Main Question: Has anyone faced a similar challenge and been successful in creating a solution in google (w/ or w/o app script)? We really don't need the features that drive vendors to license bloatware.

Secondary: Has anyone used a lean software they would recommend / is worth the value?

Thank you for any help you can offer


r/GoogleAppsScript • • Mar 06 '26

Question Nested functions in a library

7 Upvotes

I am currently building out a Google apps script library and I am trying to organize functions with like functions. In doing so, I would l like to have “nested functions” not sure if that is the right term. But essentially want it to work similarly to how Googles Chat advanced service or something works, I.e. Chat.Spaces.Messages.create().

In my case it would be something like:

Library.firstNest.sending(message)

I have this somewhat working, but it does not do any autocomplete and does not display my JSDoc-style documentation.

Is it possible to do this with autocomplete and documentation?


r/GoogleAppsScript • • Mar 04 '26

Question Complete Beginner on GoogleAppsScript.

7 Upvotes

Hi! I'm a complete beginner to the coding platform. I'm not sure this is the right platform to ask this question too, but I'm going to ask.

I'm very much interested in GoogleAppsScript. I have no clue of where to start from. What language should I know before approaching GoogleAppsScript?

Any guidance from you all is much appreciated.


r/GoogleAppsScript • • Feb 28 '26

Question I want to build out my portfolio. Tell me the most annoying manual task you do in Google Sheets, and I’ll build an Apps Script to automate it for free.

7 Upvotes

Hey everyone, I'm a tech consultant looking to build a portfolio of micro-tools and automations. Instead of building random things nobody needs, I want to solve real problems.

If you spend hours every week copying/pasting data, sending repetitive emails based on spreadsheet rows, or trying to connect Sheets to other tools (CRMs, Slack, etc.), drop a comment below.

Tell me your exact workflow and what’s causing you a headache. I'll pick the most interesting ones, write the Google Apps Script / formula for you, and share the solution. No strings attached. What are you struggling with?


r/GoogleAppsScript • • Jan 30 '26

Question v8 runtime performance disparity between users (workspace vs. gmail accounts)

7 Upvotes

We recently updated our Apps Script project to the v8 runtime (last minute, I know). Over the past couple days, we've been getting reports from users that our product flow, which analyzes and reformats Google Docs on behalf of users, became excruciatingly slow.

After some debugging, we found that for *some* users, the v8 runtime is extremely slow when making calls to core Google services like the Document Service. Some users see a ~10x slowdown compared to others, which is pretty shocking.

We're not confident about this, but all of the "fast" users I've seen are Workspace accounts, and all the "slow" ones are Gmail / personal accounts. But there's still variation even among Gmail accounts.

I'm curious – has anyone experienced anything similar? Or have any suggestions for how we might debug or work around the issue?

I filed a bug report with a minimal reproducible example here: https://issuetracker.google.com/issues/479843184


r/GoogleAppsScript • • Jan 26 '26

Question TIL there's a P1/S0 GAS bug that's been around for 8 years :)

7 Upvotes

Unexpected "authorization is required" error. https://issuetracker.google.com/issues/69270374

Doesn't look like this will ever get solved. Customer is complaining.

Anyone have a workaround?

Current thought is to have user install my Add-On for their default Google account too.

That way, the *effective* email will now be authorized, and I will write code that ensures the *intended* email is used for any actions.


r/GoogleAppsScript • • Jan 24 '26

Unresolved How to bypass the 6min execution limit?

7 Upvotes

Has anyone found a workaround/solution to this?


r/GoogleAppsScript • • Nov 30 '25

Question Does gmail.readonly require CASA audit? Is it really 15k+?

7 Upvotes

I am trying to create a website that would require reading certain user emails. I would then use chatgpt, or some other chatbot, to extract information from these filtered emails. I will discard the emails after that and only save the chatbots response. I want to make things simple for the user, only having to press a button authorizing access, or something similar. I have been finding conflicting information about CASA auditing for readonly and I am overall confused on how this process works. I have heard of using n8n, Zapier or something of the sort as an alternative but not sure what the best option is. Just a college student so I really dont have much money to spend, looking for something free or very cheap if possible. Thanks!


r/GoogleAppsScript • • Nov 20 '25

Question I just made a simple macro in Sheets, but it says it's not verified?

7 Upvotes

The Macro: Merge selected cells, center vertically. That's it.

When I run it, I get a popup:

Authorization required

A script attached to this document needs your permission to run.

Then if I click ok, it asks me to sign in, then it prompts me with:

Choose an account

to continue to Untitled project

Untitled project? This is a google sheet I've had for years and it's named/titled.
When I click on Untitled project, it shows "Developer Info" - like the developer is named Untitled Project which seems scammy.

Then even if I click my account, I get:

Google hasn’t verified this app

The app is requesting access to sensitive info in your Google Account. Until the developer (my-email is here) verifies this app with Google, you shouldn't use it.

Then if I click Advanced, and proceed anyway with (UNSAFE) in brackets, I get:

This app hasn’t been verified by Google. Because this app is requesting some access to your Google Account, you should continue only if you know and trust this app developer. Learn more

You can let the app developer (my email again) know that they need to submit a request to have this app verified by Google. Otherwise, some of this app’s access to your data may be lost.

This is soooo sketchy, you're asking me to get used to doing dodgy things I've trained myself not to do and I have a dilemma just to run a simple script. What do I do?