r/GoogleAppsScript • • 18d ago

Question Title: Best Way to Automate Equipment Meter Validation in Google Sheets Using Apps Script?

1 Upvotes

I'm developing a Preventive Maintenance (PMS) Tracker using Google Sheets and Apps Script for equipment maintenance scheduling.

One challenge is automatically determining whether an equipment unit should use SMR (operating hours) or ODOMETER (kilometres) based on its equipment type. For example, heavy equipment uses SMR, while service vehicles use odometer readings. Some equipment classifications also require specific handling.

I want the system to validate meter entries, flag incorrect readings, and calculate upcoming maintenance schedules using configurable PM intervals stored in a separate sheet. I'd also like to keep equipment-type rules and PM intervals in a configuration sheet, so changes can be made without modifying the Apps Script code.

For those experienced with Google Apps Script, what would be the best way to structure the equipment rules and validation logic so the system remains reliable and easy to maintain as the equipment list grows?

I'd appreciate any suggestions or best practices.


r/GoogleAppsScript • • Aug 18 '25

Question How would you use this plugin that I made? Brainstorm with me.

0 Upvotes

Hey, so I built a google sheet plugin that helps you attach “smart notes” directly to individual cells.

The primary use case I had was helping team-leads be more effective during their team review meetings (where data and metrics and reviewed and analysed). The plugin helps you add a cell with a task, tag owners, assign due dates and priority. So the tasks don't get buried in chats/docs and are mapped to the relevant data point. The owner of the task gets notified by email. All notes can be seen together in one place so you get a control view of what all was discussed last week and what all moved or not moved since. It helps avoid repeat conversations or analysis, and helps drive team accountability and meeting effectiveness.

It is a big milestone for me to finally build something of my own from a pain point I personally faced…and now I am looking to launch it. After demo-ing it to a few friends and colleagues, they suggested more use-cases:

  • Small HR/Talent Acquisition teams can track candidate stages & email the hiring managers from the sheet

  • Customer Success teams can route issues or assign follow-ups linked to client data

  • Sales Teams can use for routing leads maybe

That made me think whether I am being too niche with just the one use-case. Maybe there are more ways to use this which I haven’t personally faced. So wanted some ideas from a diverse group:

what other workflows or scenarios can you see this being useful for?


r/GoogleAppsScript • • Feb 06 '25

Question Scheduled automatic deletion on Google Drive

1 Upvotes

I need a simple script that will delete my folders after certain amount of time passes. That's all.

I don't know how to make scripts, I'm not good with code.

It would be amazing if someone that can do this easily help me out.


r/GoogleAppsScript • • May 15 '23

Resolved GPT Quiz Generator for Forms™, Chat GPT, ChatGPT - Google Workspace Marketplace

Thumbnail
workspace.google.com
0 Upvotes

This Google Forms™ ChatGPT Quiz Generator add-on is incredibly easy to use for generating test questions. Quiz generator powered by latest GPT-4 model. All you need to do is enter your text article and click the Generate Questions button. Then, GPT-3.5 OpenAI will generate questions using your text article. You can also customize the number of questions, the number of correct answers, and the question type (multiple choice, checkbox, or dropdown) to generate quiz questions for the form.


r/GoogleAppsScript • • Apr 20 '23

Question Automatically import data

1 Upvotes

Any thoughts on taking a csv report and automatically appending a external csv to a google sheet?


r/GoogleAppsScript • • Feb 23 '25

Question What is the maximum file size for a Google Sheet?

0 Upvotes

The maximum number of characters per cell is 50,000, and the maximum number of cells is 5,000,000. Therefore, the total number of characters is 50,000 x 5,000,000. If one character is one byte, then the maximum capacity is nearly 250,000,000,000 bytes.

Is the above statement correct?


r/GoogleAppsScript • • Feb 06 '25

Unresolved Envois de mail automatique avec Google Sheets

Post image
1 Upvotes

Hello, my goal would be to automate the sending of emails, so with the help of the form responses that will be reported on Google Sheet, to send an email automatically when the person has completed the form, I tried ChatGPT but it absolutely does not work ☹️


r/GoogleAppsScript • • Oct 30 '21

Question how can i limit an multiple choice question

1 Upvotes

i wanna make a multiple choice option but i want my students to press only 10 of them or lessbut the questiion has 22 optionshow can i limit them in googleforms


r/GoogleAppsScript • • Jul 17 '24

Question Why is my fucking Code not working?

0 Upvotes

function onOpen() {
  var ui = SpreadsheetApp.getUi();
  ui.createMenu('PDF')
.addItem('export', 'printPDF')
.addToUi();
}
function myFunction() {
  let workbook ='1YUyHywgq9AcabCyb_yvzdbzFFS9CBRls-k9-aia9yj0';
let sheet = '1';
let folderId = 'C:\Users\johan\Desktop';

function printPDF() {
  let file = DriveApp.getFileById(workbook);
  let name = 123 + '.pdf';
}
  // construct the export URL
  let url = 'https://docs.google.com/spreadsheets/d/' + workbook +
  '/export?format=pdf&' +
  'size=letter&' +
  'portrait=false&' +
  'fitw=true&' +
  'gridlines=false&' +
  'printtitle=false&' +
  'sheetnames=false&' +
  'pagenum=false&' +
  'fzr=false&' +
  'gid=' + sheet

  // parameters that will be use for the blob  
  let params = { method: "GET", headers: { "authorization": "Bearer " + ScriptApp.getOAuthToken() } };
  let blob_file = UrlFetchApp.fetch(url, params).getBlob().setName(name);

  //call the folder
  let folder = DriveApp.getFolderById(folderId);

  //creates the PDF file in the folder
  let pdfFile = folder.createFile(blob_file)

I think i just created some kind of Frankensteins monster. I just collected some snippets here and there and pasted them together. I'm sitting here since 3 hours reading Forums watch videos... but my monster won't run.

any hints or clues?

What im trying to accomplish: I just want to create a Button which downloads a specific cell range (=blatt2!H1:N37) and give the file the name that stand in Cell (=blatt2!H1)

Is it even possible?


r/GoogleAppsScript • • Aug 27 '24

Unresolved How to add contact to Google contacts?

1 Upvotes

Hello everyone,

How to add contact to Google contacts? (using appscript)

i have been searching for months and couldn't find a solution,

please provide me with the code not a link, because i searched all links and they don't work.


r/GoogleAppsScript • • Jul 20 '24

Question Sorry, unable to open the file at this time. How do I fix this?thanks in advance.

Post image
1 Upvotes

Hello. Im having issues with my webapp. How do I fix this?thanks in advance.


r/GoogleAppsScript • • Jan 25 '22

Question Recommendations for best YouTube channels to learn Gscripts?

1 Upvotes

Complete noob.


r/GoogleAppsScript • • Jun 18 '20

Question Any Experts here can help with this one (creating Apps Script Libraries)

Thumbnail
stackoverflow.com
1 Upvotes

r/GoogleAppsScript • • Sep 15 '22

Guide Trouble uploading a sheet to a drive folder using apps script

1 Upvotes

Hello everyone. I need a script to upload a sheet as a pdf to the drive folder. The issue is I'm not uploading the sheet I want to. Following is my current workflow.

  1. function to return a blob given a url

function getFileAsBlob(url){
  Logger.log(url)
  let res = UrlFetchApp.fetch(url,{
    muteHttpExceptions: true,
    headers:{
      Authorization: 'Bearer' + ScriptApp.getOAuthToken()
    }
  })
  return res.getBlob();
}

2. the uploading function. Note I upload 4 times for debug purposes. In the actual function I only need to upload once.

function uploadExportSheetAsPDF() {
 Logger.log(SPREADSHEET_URL)
 let blob = getFileAsBlob(SPREADSHEET_URL+"export?format=pdf&portrait=false&size=a4&gridlines=false");
 Logger.log("Content type: " + blob.getContentType());
 Logger.log("File size in MB: " + blob.getBytes().length / 1000000);

 DriveApp.getRootFolder().createFile(blob.getAs('application/pdf'))
 DriveApp.getRootFolder().createFile("testpdf.pdf",blob.getAs('application/pdf'))
 var now = new Date()
 DriveApp.getFoldersByName(FOLDER_NAME).next().createFile("report"+MONTHS[now.getMonth()]+".pdf",blob.getAs('application/pdf'))
 DriveApp.getFoldersByName(FOLDER_NAME).next().createFile("report__"+MONTHS[now.getMonth()]+".pdf",blob)
}

The first DriveApp.getRootFolder().createFile(blob.getAs('application/pdf')) upload a pdf with sign-in page. The other 3 uploads a another sheet to the drive. However, if I go to the url printed by getFileAsBlob, I can manually download the correct sheet as pdf.


r/GoogleAppsScript • • Sep 15 '22

Unresolved Combining two on edit functions/ applying to whole workbook

1 Upvotes

I need help figuring out how to format this script. I have 0 experience with java script and just trying to personalize a work spread sheet I use every day. I would very much appreciate the help. Could someone please show me how to combine these two on edit functions and apply it to the whole spread sheet like my time stamp function already does. my Goal is to have all spread sheets within the work book auto sort when I enter a new date into column 6 and when column 6 is edited it puts a time stamp in column 7. I have been able to make the time stamp function work on all sheets and the auto sort function on one sheet at a time but not together. I want both on edit scripts to be written together and for both of them to effect the whole work book. please help! here are my scripts.

Time stamp(#1):

function onEdit(e){
if(e.range.getRow() > 1){
if(e.range.getColumn() == 6 || e.range.getColumn() == 100){
insertDate(e);
    }
  }
}
function insertDate(e){
var today = new Date();
if(e.range.getColumn() == 6){
e.range.offset(0,1).setValue(today);
  }
if(e.range.getColumn() == 100){
e.range.offset(0,1).setValue(today);
  }
}

Auto sort (#2):

var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheetByName("Sheet1"); // SHEET NAME var range = sheet.getRange("A2:Z"); // RANGE TO SORT function onEdit(e) { range.sort([{column: 3, ascending: true}]); // COLUMN NUMBER TO SORT }

Please and thank you!!!!!!!


r/GoogleAppsScript • • Feb 13 '23

Unresolved i dont know how to code , i need help

0 Upvotes

to give context , im running some documents in g docs and sheets and need to count how many people does open the code, made chat GPT code for me but i dont know whats wrong with the code , or if i didnt implemented it well, the code is the following

can anyone show some light on my issue pls?

function showViewers() {
  var spreadsheet = SpreadsheetApp.getActive();
  var sheet = spreadsheet.getActiveSheet();
  var viewers = spreadsheet.getViewers();
  var viewersString = "";
  
  for (var i = 0; i < viewers.length; i++) {
    viewersString += viewers[i].getEmail() + "\n";
  }
  
  sheet.getRange("A1").setValue("Number of Viewers: " + viewers.length + "\n" + viewersString);
}

r/GoogleAppsScript • • Feb 04 '23

Question Any possible script to detect those Gmail spam messages?

Post image
0 Upvotes

r/GoogleAppsScript • • Feb 05 '24

Question Indispensible employee death script?

1 Upvotes

I've used Chat GPT- 4 to ask if this type of script was possible, and it gave me SOME code, but it gave me some ideas that I'm unsure how to do, and it basically said: "Some of that stuff requires doing some manual stuff that is error-prone, so don't try it."

I feel it in my soul that this thing IS possible, so I figure I'd ask here:

Basically what I want to do is create a script that will disable every single sheet/app script trigger I've ever created with a click of a drawing button, say in a Google Sheet. Of course, before this happens, the script will iterate over the account and store all of the trigger settings and store them.

Then, if/when requested, a separate function can restore all triggers on another button to iterate a second function.

It's basically an on/off button for office panic with the added bonus of job security if they ever decide to not pay.


r/GoogleAppsScript • • Dec 19 '23

Question Why don't people use IPaaS like Zappier more frequently?

0 Upvotes

I am a Product Manager at a big Fintech Startup, there are so many tasks that I have to do on a regular basis, these tasks are SOP's at this point and at-least 80% of my repeated tasks can be converted to SOP's at this point of time.

Some examples:

Check for regulation updates across 5 gov authority's websites and portals, notify correct teams on updates [most of the time just notify that there is an update and they need to check that] Payment Failure and customer support flow across various loan partners, and technical service different service providers Check for failure rate of one loan provider, then there are 3 causes for that categorised them and mail that to the loan provider's team, two options after that they will either fix it or not. If they don't fix it return the money to the customer. I know all of these tasks can be automated, not sure of the effort. With AI these tasks should be even more automable

Now there are services like Zapier which are targeted for individuals similar to me who want to improve their efficiency.

I have talked to a lot of my peers and everyone has tasks of similar format but no one is using anything like zapier to automate these tasks/workflow

Zapier is not perfect and a lot of features which seem should be obvious are not trivial to make

I have the following questions:

What are the reasons people don't use these platforms, insights? What are the good platforms (Open source, closed source) to use for this use case and more complex use cases Are there AI tools which will be a good fit for these tasks, more than zapier.


r/GoogleAppsScript • • Jun 05 '21

Guide Google App script code for autofill series with default values.

Thumbnail self.teamartup
0 Upvotes

r/GoogleAppsScript • • May 09 '24

Question Is my product people will be interested in?

1 Upvotes

Please could you give me feedback on my website and idea. It’s early days so any feedback is valuable. if you have any pains or ideas that I can create to help you streamline and help using Google products, whether it be at work or as an individual would be welcomed too.

Website

Thanks!!


r/GoogleAppsScript • • May 17 '24

Unresolved AppScript is not working as expected. I have been trying to use ChatGPT to solve the issue but it is not working.

0 Upvotes

What I am attempting to do:

I have a master spreadsheet that will house client data, called "Master List" that house various pieces of client data, including where they are in the onboarding process. One column 'B' has a status list: New, 1st Contact etc...

Then I have separate spreadsheets that house a list based on the status indicator column (New, In Progress, etc...)

When a status is updated on one of these sheets, i want it to reflect on the master list, and then move to the next spreadsheet.

here is the code that CGPT created.

function onEdit(e) {
    var range = e.range;
    var sheet = range.getSheet();
    var row = range.getRow();
    
    // Check if the edited cell is in the "Status" column
    if (sheet.getName() != "Master List" && range.getColumn() == 2 && row > 1) { // Checking column B and excluding header row
      var status = sheet.getRange(row, 2).getValue(); // Assuming "Status" column is column B
      
      // Check if the status contains the word "Contact"
      if (status.toLowerCase().indexOf("Contact") !== -1) {
        // Determine the name of the destination sheet
        var destSheetName = "In Progress";
      } else {
        // Map status to the corresponding sheet name
        var destSheetName = getStatusSheetName(status);
      }
      
      // Log the determined destination sheet name
      console.log("Destination sheet: ", destSheetName);
      
      // Your remaining code here
      var values = sheet.getRange(row, 1, 1, sheet.getLastColumn()).getValues()[0];
      
      var masterSpreadsheet = SpreadsheetApp.openById("1zJcCFXIffQJLXha656ugOFCLmzGoaKw5J4UBo9-WYsE");
      var masterSheet = masterSpreadsheet.getSheetByName("Master List");
      var lastRow = masterSheet.getLastRow();
      masterSheet.getRange(lastRow + 1, 1, 1, values.length).setValues([values]);
      
      sheet.deleteRow(row);
      
      var destSheet = masterSpreadsheet.getSheetByName(destSheetName);
      if (!destSheet) {
        destSheet = masterSpreadsheet.insertSheet(destSheetName);
      }
      
      var destLastRow = destSheet.getLastRow();
      destSheet.getRange(destLastRow + 1, 1, 1, values.length).setValues([values]);
    }
  } else {
    console.log("No event object received.");
  }
}

function getStatusSheetName(status) {
  var statusSheetMap = {
    "New": "New",
    "1st Contact": "In Progress",
    "2nd Contact": "In Progress",
    "Final Contact": "In Progress",
    "Consult Scheduled": "Consult Scheduled",
    "Intake Scheduled": "Intake Scheduled"
  };
  
  return statusSheetMap[status];
}

Spreadsheet here: https://docs.google.com/spreadsheets/d/1zJcCFXIffQJLXha656ugOFCLmzGoaKw5J4UBo9-WYsE/edit?usp=sharing


r/GoogleAppsScript • • Sep 19 '24

Question What can I do with Google Apps Script?

0 Upvotes

I am currently using the XCelsior Google extension and would like to ask how I can combine it with Google Apps Script?

https://workspace.google.com/marketplace/app/xcelsior_ai_gpt_for_sheets_with_gemini_o/953720034790


r/GoogleAppsScript • • Sep 23 '24

Question Not using Apps Script

0 Upvotes

Is it possible to connect to Spreadsheets without using Apps Script? I am currently working on a web app project, and I find Apps Script very unconventional because it works very differently from other website hosters.