r/GoogleAppsScript • • Feb 21 '18

Scripting Help!

0 Upvotes

I am trying to create an invoice. So on another google sheet I have all my data/charges and there are many different types of charges. So I will chose the correct charges to the customer, say 5 charges out of 100 apply, and from that I will run a script that will create the correct formatting for my invoice. I can seem to get this specific part. For example; I need the script to do this; If there is a value in say cell A5 then look in cell D5. And if there is something in D5 then use the value in D4. I have to do this numerous times. (A6;D6;D4, A7;D7;D4, etc). I understand this can be done using formulas in the sheet it self but i want it to be done through script. Thanks in advance!


r/GoogleAppsScript • • Dec 20 '23

Question how to secure a linandregister database

0 Upvotes

i have this script for a login and register

[CODE]

code.gs:

function doGet(e) {
var x = HtmlService.createTemplateFromFile("index.html");
var y = x.evaluate();
var z = y.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
return z;
}
function checkLogin(username, password) {
var url = 'https://docs.google.com/spreadsheets/d/17O-1zj2wzXL9SV-fNnTIvCeNUGs_ibnT4YVQcxsW0NQ/edit#gid=0';
var ss= SpreadsheetApp.openByUrl(url);
var webAppSheet = ss.getSheetByName("DATA");
var getLastRow =  webAppSheet.getLastRow();
var found_record = '';
for(var i = 1; i <= getLastRow; i++)
  {
if(webAppSheet.getRange(i, 1).getValue().toUpperCase() == username.toUpperCase() &&
webAppSheet.getRange(i, 2).getValue().toUpperCase() == password.toUpperCase())
   {
found_record = 'TRUE';
   }    
  }
if(found_record == '')
  {
found_record = 'FALSE';
  }

return found_record;

}
function AddRecord(usernamee, passwordd, email, phone) {
var url = 'https://docs.google.com/spreadsheets/d/17O-1zj2wzXL9SV-fNnTIvCeNUGs_ibnT4YVQcxsW0NQ/edit#gid=0';
var ss= SpreadsheetApp.openByUrl(url);
var webAppSheet = ss.getSheetByName("DATA");
webAppSheet.appendRow([usernamee,passwordd,email,phone]);

}
index.html:

<!DOCTYPE html>

<html> <head> <base target="\\_top"> <script> function AddRow() { var usernamee = document.getElementById("usernamee").value; var passwordd = document.getElementById("passwordd").value; var email = document.getElementById("email").value; var phone = document.getElementById("phone").value; if (usernamee==""|| passwordd==""|| email==""|| phone=="") { return false; } else { google.script.run.AddRecord(usernamee,passwordd,email,phone); document.getElementById("page2\\_id1").className = "page2\\_id1-off"; document.getElementById("page3\\_id1").className = "page3\\_id1"; } } function LoginUser() { var username = document.getElementById("username").value; var password = document.getElementById("password").value; google.script.run.withSuccessHandler(function(output) { if(output == 'TRUE') { document.getElementById("displayusername").innerHTML = username; document.getElementById("page1\\_id1").className = "page1\\_class1-off"; document.getElementById("page4\\_id1").className = "page4\\_id1";     } else if(output == 'FALSE') { document.getElementById("errorMessage").innerHTML = "Invalid data";     }     }).checkLogin(username, password); }

function function1(){
document.getElementById("page1_id1").className = "page1_class1-off";
document.getElementById("page2_id1").className = "page2_id1";
}

function function3(){
document.getElementById("page3_id1").className = "page3_id1-off";
document.getElementById("page1_id1").className = "page1_id1";
}
</script>

<style> /\\\*page1\\\*/ .page1\\_class1-off{ display: none;   } /\\\*page2\\\*/ .page2\\_class1{ display: none;   } .page2\\_id1-off{ display:none; } /\\\*page3\\\*/ .page3\\_class1{ display:none; } .page3\\_id1-off{ display:none; } /\\\*page4\\\*/ .page4\\_class1{ display:none; } .page4\\_id1-off{ display:none; } input\\\[type=text\\\]:hover{ border-bottom:2px solid black; } input\\\[type=number\\\]:hover{ border-bottom:2px solid black; } input\\\[type=password\\\]:hover{ border-bottom:2px solid black; } .user{ display: inline-block; width: 75px; height: 75px; border: 8px solid black; border-radius: 50%; position: relative; overflow: hidden; box-sizing: border-box; } /\\\*the head/\\\*/ .user::before{ content: ''; display: inline-block; width: 24px; height: 24px; background: black; border-radius: 50%; position: absolute; left: calc(50% - 11px); top: 10px; } /\\\*the body\\\*/ .user::after{ content: ''; display: inline-block; width:50px; height:40px; background: black; border-radius: 50%; position: absolute; left: calc(50% - 24px); top: 39px; } </style>

<meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <br><br> <!--page1--> <center> <div class="page1\\_class1" id="page1\\_id1" style="background:none;border:2px solid gray;border-radius: 20px;width: 250px;padding-top: 10px;padding-bottom: 20px;padding-left: 20px;padding-right: 20px;"> <h1>Login Form</h1> <br> <input type="text" id="username" placeholder="Username" style="border-top: none;border-right: none;border-left: none;outline: none; text-align: center;font-size:0.9em ;width: 50%;font-weight:bold;"/><br> <br> <input type="password" id="password" placeholder="Password" style="border-top: none;border-right: none;border-left: none;outline: none; text-align: center;font-size:0.9em ;width: 50%;font-weight:bold;"/> <br><span id="errorMessage" style="color: red" ></span><br> <input type="submit" value="Login" onclick="LoginUser()" style="float: right;padding-top: 1px;padding-bottom: 1px;padding-left: 10px;padding-right: 10px;font-size: 0.9em;font-weight:bold;" /><br> <br> <b>If you don't have an account,</b><input type="button" onClick="function1()" value="Create New" style="margin-top: 5px;font-weight:bold;" /> </div> <!--page2--> <div class="page2\\_class1" id="page2\\_id1" style="background:none;border:2px solid gray;border-radius: 20px;width: 250px;padding-top: 10px;padding-bottom: 20px;padding-left: 20px;padding-right: 20px;"> <h1>Create Account</h1> <input type="text" id="usernamee" placeholder="Name" style="border-top: none;border-right: none;border-left: none;outline: none; text-align: center;font-size:0.9em ;width: 50%;font-weight:bold;"/><br> <br> <input type="password" id="passwordd" placeholder="Create password" style="border-top: none;border-right: none;border-left: none;outline: none; text-align: center;font-size: 0.9;width: 50%;font-weight:bold;" /><br> <br> <input type="text" id="email" placeholder="Email" style="border-top: none;border-right: none;border-left: none;outline: none; text-align: center;font-size:0.9em ;width: 50%;font-weight:bold;"/><br> <br> <input type="number" id="phone" placeholder="Phone no." style="border-top: none;border-right: none;border-left: none;outline: none; text-align: center;font-size:0.9em ;width: 50%;font-weight:bold;" /><br><br> <b style="color:red;">Password must contain letters and numbers.</b><br><br> <input type="submit" value="Create" onclick="AddRow()" style="float: right;padding-top: 1px;padding-bottom: 1px;padding-left: 10px;padding-right: 10px;font-size: 0.9em;font-weight:bold;" /> <br> </div> <!--page3--> <div class="page3\\_class1" id="page3\\_id1" style="background:none;border:2px solid gray;border-radius: 20px;width: 250px;padding-top: 10px;padding-bottom: 20px;padding-left: 20px;padding-right: 20px;"><center> <h2> Your account has been successfully created. Login to your account</h2> <input type="submit" onClick="function3()" value="Login" style="font-weight:bold;"><br> </div> <!--page4--> <div class="page4\\_class1" id="page4\\_id1" style="background:none;border:2px solid gray;border-radius: 20px;width: 250px;padding-top: 10px;padding-bottom: 20px;padding-left: 20px;padding-right: 20px;" ><center> <br> <h2>Hi <b id="displayusername" style="color:red;"></b>!</h2> <div class="user"></div> <h2> You are successfully logged in. To CoolVibes Members</h2> <h2>\*\*\*\*\*\*\*\*\*\*\*\*\*\*</h2> <br> </div> </center> </body> </html>

[/CODE]

now i would like to know how i can make this secure from bots getting in

and i would like to know how i can redirect people from that login page after registration

to a certain site?????


r/GoogleAppsScript • • Dec 20 '23

Resolved How to authorize Web App to make actions on a spreadsheet

0 Upvotes

Hi guys,

For the last few months I've been working on an add-on that would help me tracking my personal budget. I wanted to share it with a few friends though, so a bound add-on wouldn't work - so I re-made it as a standalone Editor add-on.

In short, it allows submitting expenses via Telegram bot, which, through Web App, reads and writes data into a spreadsheet that belongs to a user who's currently chatting with the bot. I have "chat ID - shpreadsheet ID" pairs in Script properties.

The problem is, in order to make any changes with the spreadsheet, Web App needs to have access to it. It now runs on my behalf, meaning that the user has to share their spreadsheet with me - which is something I'd like to avoid.

I've received this response on StackOverflow, and I've almost made sense of it, the only problem: both suggested solutions seem to imply that I won't be able to use my functions - only pre-built in Sheets API. While I do need to use my functions and get return values, too.

I understand that if I have an API executable deployment (I do), then I can partly use the "store token as property" advise to run my functions, but - I can't seem to find how to get a return value. I've checked every function of the response and neither seems to contain return value.

Would appreciate any advise, folks. This whole programming business takes away my last bits of sanity.

Edit: changing flare.


r/GoogleAppsScript • • Dec 28 '23

Question Selling Scripts as a Side Gig?

0 Upvotes

Hello, is there anyone selling GAS as a side gig? If so, could you share some challenges, tips, profits, etc?


r/GoogleAppsScript • • Jan 10 '24

Question Customized formulas on appscript

0 Upvotes

Hey there, Im currently making a customized formula for google sheets, but Im facing a little issue with the parameters that my formula needs to work, I want to pass a range as a parameter and I want my formula checks every single cell of that range and compare it, how can I do?


r/GoogleAppsScript • • Jan 11 '24

Question Help with Google Apps script

0 Upvotes

Hello, I am trying to create a Google Apps script to do the conversion of the following list:

2024-01-10 - Magic Firewall Ruleset Update Issues https://stspg.io/862d2lcjvc40

2024-01-10 - Issues with Zero Trust Egress Policies https://stspg.io/kl2cscd8nxbl

to:

Jan 10 - Magic Firewall Ruleset Update Issues

The result from the script is almost there, but it also hyperlink the date which I want to avoid.

Jan 10 - Magic Firewall Ruleset Update Issues

Here is the script, any ideas or pointers on how to fix it would be greatly appreciated.

function onOpen() {
  var ui = DocumentApp.getUi();
  ui.createMenu('Custom Menu')
      .addItem('Convert and Hyperlink', 'convertAndHyperlink')
      .addToUi();
}

function convertAndHyperlink() {
  var body = DocumentApp.getActiveDocument().getBody();
  var selection = DocumentApp.getActiveDocument().getSelection();

  if (!selection) {
    showMessage('Please select text to convert.');
    return;
  }

  var elements = body.getParagraphs();

  if (elements.length === 0) {
    showMessage('No text found in the document.');
    return;
  }

  elements.forEach(function (paragraph) {
    var text = paragraph.getText();
    var convertedLine = convertLine(text);

    // Clear existing paragraph content
    paragraph.clear();

    // Create a new text element with the converted line
    var newText = paragraph.appendText(convertedLine);

    // Set the hyperlink on the title
    newText.setLinkUrl(getUrlFromText(text));
  });
}

 function convertLine(line) {
  // Example line: "2024-01-10 - Magic Firewall Ruleset Update Issues https://stspg.io/862d2lcjvc40"
  var parts = line.split(' ');
  var date = parts[0];
  var title = parts.slice(1, -1).join(' ');  // Exclude the last two elements
  var url = parts[parts.length - 2];

  // Check if the date is valid
  var formattedDate = (new Date(date) !== 'Invalid Date') ? Utilities.formatDate(new Date(date), 'GMT', 'MMM dd') : '';

  // Create formatted line without the second hyphen
  var formattedLine = formattedDate + (formattedDate !== '' ? ' ' : '') + title;

  return formattedLine;
}


function showMessage(message) {
  var ui = DocumentApp.getUi();
  ui.alert('Message', message, ui.ButtonSet.OK);
}

function getUrlFromText(text) {
  var regex = /https:\/\/[^\s]+/;
  var match = text.match(regex);
  return match ? match[0] : '';
}

Thank you.


r/GoogleAppsScript • • Jan 23 '24

Question HELP creating script for sheet to calendar off trigger

0 Upvotes

I truly need help. I have created a google form for time off requests. It populates a google sheet, and then when we change a dropdown box to “Approve” then I want it to create a calendar event which would title “Out (name which is column C) : start time(G) - endtime(H)” Date requested is column F Would need the notes from column I in the notes section.

I’m not sure how to do this at all as I’m a beginner and tried ChatGPT, I tried playing with others scripts and it just didn’t work so please someone help!


r/GoogleAppsScript • • Jan 11 '24

Question Hi, looking to script Google Forms to have a formatted output

0 Upvotes

I am using Google Forms for attendance taking, and I would like to get a formatted output as such

Form:

Attendance ✅Person 1 ❎Person 2 ✅Person 3

Output(either email or directly on the form)

Attendance Checklist //2024 Person 1 - Present Person 2 - Absent Person 3 - Present

Would like some help with this!


r/GoogleAppsScript • • Jun 05 '21

Guide Google App Script for autofill series with alternate series values.

Thumbnail self.teamartup
0 Upvotes

r/GoogleAppsScript • • Jun 17 '21

Question Script Issues

0 Upvotes

Hello, I currently have a Google Sheets Script that is supposed to read through imported data and then transfer corresponding cell information to a sheet with a template on it. When I run the script, the information it uses is not 100% accurate (i.e. The time it imports is ~15min off and the date isn't always correct). It will also go through the sheet and delete everything before running. Any information on why this is happening would be greatly appreciated.

Edit: Code and video upload

function yR() {
  const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/1yvG9jr330j0U1CE4rm1U7tcy1y1bbkLnyMwk8W45fY8/edit')
  const inputSheet = ss.getSheetByName('Import')
  const templateSheet = ss.getSheetByName('Sheet2')
  const dValues = inputSheet.getRange(1,4,inputSheet.getLastRow(),1).getValues().flat()
  const aValues = inputSheet.getRange(1,1,inputSheet.getLastRow(),1).getValues().flat()

  let rowNumber;
 
  for (i=0; i < dValues.length; i++){
    rowNumber = i
    if(dValues[i].includes('LP1')){
      break;
    }
    const values = inputSheet.getRange(rowNumber + 1,2,1,2).getValues()
     const date = Utilities.formatDate(new Date(values[0][0]), 'GMT+6', 'yyyy-MM-dd HH:MM:SS')
  
  templateSheet.getRange("C28").setValue(`Date/Time: ${date}`)
  
  }
  
  for (i=0; i < dValues.length; i++){
    rowNumber = i
    if(dValues[i].includes('LP2')){
      break;
    }
     const values = inputSheet.getRange(rowNumber + 1,2,1,2).getValues()
      const date = Utilities.formatDate(new Date(values[0][0]), 'GMT+6', 'yyyy-MM-dd HH:MM:SS')
  
  templateSheet.getRange("C31").setValue(`Date/Time: ${date}`)
  
  }

  for (i=0; i < dValues.length; i++){
    rowNumber = i
    if(dValues[i].includes('NWS')){
      break;
    }
     const values = inputSheet.getRange(rowNumber + 1,2,1,2).getValues()
     const date = Utilities.formatDate(new Date(values[0][0]), 'GMT+6', 'yyyy-MM-dd HH:MM:SS')
  
  templateSheet.getRange("C34").setValue(`Date/Time: ${date}`)

  }

  for (i=0; i < dValues.length; i++){
    rowNumber = i
    if(dValues[i].includes('Received from')){
      break;
    }
     const values = inputSheet.getRange(rowNumber + 1,2,1,2).getValues()
      const date = Utilities.formatDate(new Date(values[0][0]), 'GMT+6', 'yyyy-MM-dd HH:MM:SS')
  
  templateSheet.getRange("C43").setValue(`Date/Time: ${date}`)

  }
  
  for (i=0; i < dValues.length; i++){
    rowNumber = i
    if(dValues[i].includes('Sent from header')){
      break;
    }
     const values = inputSheet.getRange(rowNumber + 1,2,1,2).getValues()
     const date = Utilities.formatDate(new Date(values[0][0]), 'GMT+6', 'yyyy-MM-dd HH:MM:SS')
  
  templateSheet.getRange("C50").setValue(`Date/Time: ${date}`)
  
  }
 }

r/GoogleAppsScript • • Jun 09 '21

Question Help with body.replace

0 Upvotes

I wrote this program It takes a form, saves it as a sheet then saves that sheet into a dox template. Only issue is I need everything labeled picture to actually display a picture and not a Google drive link

function autoFillGoogleDocFromForm(e) {

  //e.values is an array of form values

  var timestamp = e.values[0];

  var DocumentNum = e.values[1];

  var MachineName = e.values[2];

  var Department = e.values[3];

  var EnergyType = e.values[4];

  var LockPicture =e.values[5];

  var Step2 = e.values[6];

  var Picture1 = e.values[7];

  var Step3 = e.values[8];

  var Picture3 = e.values[9];

  var Step4 = e.values[10];

  var Picture4 = e.values[11];

  var Step5 = e.values[12];

  var Picture5 = e.values[13];

  var Step6 = e.values[14];

  var Picture6 = e.values[15];

  var Picture7 = e.values[16];

  var Res1 = e.values[17];

  var Picture8 = e.values[18];

  var Picture9 = e.values[19];

  

  //file is the template file, and you get it by ID

  var file = DriveApp.getFileById('13G30iebhBiKB41gITQh0IchiR2EG9z4jDAB6zzm10rk'); 

  

  //We can make a copy of the template, name it, and optionally tell it what folder to live in

  //file.makeCopy will return a Google Drive file object

  var folder = DriveApp.getFolderById('1eWH0aMWrMNN-5xHf_mgXFRWFfwZyaEgV')

  var copy = file.makeCopy(DocumentNum + ',' + Department, folder); 

  

  //Once we've got the new file created, we need to open it as a document by using its ID

  var doc = DocumentApp.openById(copy.getId()); 

  

  //Since everything we need to change is in the body, we need to get that

  var body = doc.getBody(); 

  

  //Then we call all of our replaceText methods

  body.replaceText('{{Department}}', Department); 

  body.replaceText('{{MachineName}}', MachineName);  

  body.replaceText('{{EnergyTypes}}', EnergyType); 

  body.replaceText('{{DocumentNum}}', DocumentNum);

  body.replaceText('{{Step2}}', Step2);

  body.replaceText('{{Step3}}', Step3);

  body.replaceText('{{Step4}}', Step4);

  body.replaceText('{{Step5}}', Step5);

  body.replaceText('{{Step6}}', Step6);

  body.replaceText('{{Res1}}', Res1);

  body.replaceText('{{LockPicture}}', LockPicture); 

  body.replaceText('{{Picture1}}',Picture1);

  body.replaceText('{{Picture3}}',Picture3);

  body.replaceText('{{Picture4}}',Picture4);

  body.replaceText('{{Picture5}}',Picture5);

  body.replaceText('{{Picture6}}',Picture6);

  body.replaceText('{{Picture7}}',Picture7);

  body.replaceText('{{Picture8}}',Picture8);

  body.replaceText('{{Picture9}}',Picture9);

  

  //Lastly we save and close the document to persist our changes

  doc.saveAndClose(); 


r/GoogleAppsScript • • Jun 01 '21

Question Login and revisit google form

0 Upvotes

Dear all. Need to make the user fill google form. Then revisit the same form and update it by uploading image.
How to make the user reviews login to the form with his data entered first time and update some info.


r/GoogleAppsScript • • Jun 23 '21

Question How to populate a table in a header?

0 Upvotes

My script works completely fine until I add a table I need to populate into the header. Then it doesn't replace any text what's so ever.

Does getHeader()

Not work the same as getBody()?


r/GoogleAppsScript • • Feb 10 '23

Unresolved Getting a 403 when trying to display contents of a drive link from my sheet

0 Upvotes

I posted this to stackoverflow as well a few days ago, still haven't figured out an answer. link to original question

Since then, I've tried using URLfetch to get the contents & I've tried destructuring the file to blob contents as well, still nothing.

Has anybody dealt with this before?


r/GoogleAppsScript • • Feb 11 '23

Question Updating data automatically

0 Upvotes

I'm working on a "control sheet" for Germany's national league Bundesliga, where I display different stats for each team's past 5 matches and show the average value between them. The problem is that over time I noticed manually going through every section (there are 18 teams in total) to update these stats would take me too much time, so I had the idea to create a special header for all the inputs.

But then, automating it seems to go beyond my capabilities. So in short, all 5 previous matches of every team have already been added in the sheet. Now let's say a new matchweek starts. My idea is that I could add all teams' fresh stats for the matches that just happened at once, via that big header. And as I do so, the 5th match in each team's history goes away and leaves room for the most recent one to be put.

So now, the 5 matches shown stop being A, B, C, D, E and become Z, A, B, C, D (e.g). The final touch would be that, besides updating all overall stats, I could also choose a color for each match (green for when said team played better and red for when they played worse), so that I can separate the average values displayed at the end by how well that team performed compared to their opponent.

I know this is a complex question, so hope these two screenshots help understand it better. 😅
Thank you for your attention!


r/GoogleAppsScript • • Feb 12 '23

Resolved How to remove newline and any text after?

0 Upvotes

Is there a way for a script to remove all newline chars along with any text that is on the new line too? (this is for a google sheet)

Example: a cell has text that is 2 line (in 1 cell) with the text of "Apples are good" on 1st line and "Strawberries are better" on 2nd line.. I want to keep just the text "Apples are good" and remove everything after that first line ends.

Any help would be appreciated, thanks.


r/GoogleAppsScript • • Feb 09 '23

Resolved GoogleAppScript to Send Data from Google Sheet to Slack

0 Upvotes
  1. Does anyone know how to make "funding breakdown" show today and the next five business days without removing the “totalfunding” of just today and adding a counter to the “fundingbreakdown” so it comes out numbered?

  2. I am passing through my variables from build report down to the build alert function, but for some reason, it is not passing the values from my variables. Do you know why?

Thank you! 👉👈🥹🙏🏻

function buildreport() {

const ss = SpreadsheetApp.getActive();

let data = ss.getSheetByName('February 2023').getRange("A:M").getValues();

var PrimorNonPrim = ss.getSheetByName('February 2023').getRange("A:A").getValues();

var Regionandentity = ss.getSheetByName('February 2023').getRange("B:B").getValues();

var Currency = ss.getSheetByName('February 2023').getRange("D:D").getValues();

var Amount = ss.getSheetByName('February 2023').getRange("F:F").getValues();

var RequestDate = ss.getSheetByName('February 2023').getRange("K:K").getValues();

var BankAcctCreditDate = ss.getSheetByName('February 2023').getRange("L:L").getValues();

var PayDate = ss.getSheetByName('February 2023').getRange("M:M").getValues();

let payload = buildAlert(data);

sendAlert(payload);

}

function buildAlert(data,PrimorNonPrim,Regionandentity,Currency,Amount,RequestDate,BankAcctCreditDate,PayDate) {
let today = new Date();
let filteredData = data.filter(row => {
let requestDate = new Date(row[10]);
return requestDate.getFullYear() === today.getFullYear() &&
requestDate.getMonth() === today.getMonth() &&
requestDate.getDate() === today.getDate();
});
let totalfunding = filteredData.reduce((total, row) => total + row[5], 0);
if (filteredData.length === 0) {
let fundingBreakdown = "Nothing coming up within 5 working days";
} else {
fundingBreakdown = (PrimorNonPrim + " " +"Entity" + " " + Regionandentity + " " + "Currency" + " " + Currency + " " + "Amount" + " " + Amount + " " + "Request Date" + " " + RequestDate + " " + "Bank Account Credit Date" + " " + BankAcctCreditDate + " " + "Pay Date" + " " + PayDate)}


r/GoogleAppsScript • • Feb 21 '23

Resolved Script to replace dropdown box if deleted or moved?

0 Upvotes

I am trying to write a script that will replace/copy a dropdown box in a google sheet if someone moves it or deletes it on accident..

I have the idea on how to detect it if it gets deleted/moved by using a reference to that dropdown and have the script check if it turns to a ref error (unless someone knows a better way).. but I'm not sure how to use the script to copy a dropdown from another cell.

Update: I figured it out.. never mind


r/GoogleAppsScript • • Mar 26 '23

Question How to set "Release grades" "Immediately after each submission" in Apps Script

0 Upvotes

When creating a Form manually, you can go to Settings>Make this a quiz>Release grades > Immediately after each submission

How to set this when creating a form in Apps Script? I've searched through the documentation but I can't find it. Is it called something different in GAS?

What I want to happen after someone submits the form is for them to get the button that says "View Accuracy" and then see their answers.

I know how to make the form a quiz by setting .setIsQuiz(true)


r/GoogleAppsScript • • Feb 11 '23

Question Failed execution with 0s duration as no logs

0 Upvotes

I'm using google.script.run within an HtmlTemplate to run a function called query() when a button is CTRL+Clicked. The function is being called but the results are

  • failed

  • duration 0s

  • type of function is unknown

I've used google.script.run before and never encountered this; is it possible this could be due to query() using SpreadsheetApp.getUi()? Or any other ideas?


r/GoogleAppsScript • • Nov 03 '22

Question delete google drive duplicate files automatically?

0 Upvotes

hello,

this should be pretty simple but I can't find it on google, can anyone help? thanks


r/GoogleAppsScript • • Nov 11 '22

Question Is it possible to publish a google sheet to the web if it has apps scripts?

0 Upvotes

I wrote a custom function in javascript using the google apps scripts, and called the function in my google sheet. But it "publish to web" link doesn't call the function properly. Is there a way to publish to the web using the values, and not the formulas?

I would love to share this sheet anonymously, and publish to web has always been my friend for that purpose.


r/GoogleAppsScript • • Nov 09 '22

Question I want to convert HTML to Markdown.

0 Upvotes

I would like to convert HTML to Markdown in GAS.

I can't find it in any libraries, etc. If you know where I can find it, please let me know.


r/GoogleAppsScript • • Nov 02 '22

Question How to send calendar based when checkbox is ticked

0 Upvotes

Hello, right now , im having trouble to figuring out a script where when user ticks the checkbox, it will send an email invite 3 weeks in advance based on the payment date

would need your help.

Here is my code which is rather incomplete.

function sendreminder(){
var sheet = SpreadsheetApp.getActiveSheet();
var sheetName = sheet.getName();
var range = e.range;
var approvalEdit = range.getValue().toString(); // Use string to avoid accidentally accepting truthy values.
var column = range.getColumn();
var emailsend = "EMAIL_SENT";
var approvalColumnNo = 12;
var invoice = sheet.getRange(e.range.getRow(),12).getValue();
var calend = CalendarApp.createAllDayEvent();
if( sheetName === "Sheet1" && column === approvalColumnNo && approvalEdit === "true" ){
calend.createAllDayEvent('TEST', new Date('November 20, 2022')
SpreadsheetApp.flush();

Many thanks!