Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8238971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:59:11+00:00 2026-06-07T19:59:11+00:00

So I have a Google Form that feeds a Google Docs Spreadsheet. This form

  • 0

So I have a Google Form that feeds a Google Docs Spreadsheet. This form is for new people to our town to signup for our newcomers group.

I want to write a Google Apps script that will programmatically send a reminder e-mail to users who have not paid their dues 10 days after they submitted the form.

Should be easy, right?

Here’s a link to a copy of the Spreadsheet with personal data redacted out:

https://docs.google.com/spreadsheet/ccc?key=0AjsoIob8dJfodG9WN0ZmWUE1ek9rc3JrVFpDQ0J0OGc

Seems as if I should be able use Column A (“Timestamp”) with some sort of a comparison to now() to determine the 10 day part. And to get the have not paid their dues just has to be Column D does not equal Yes. The recipient’s e-mail address is, obviously, in Column X.

I’ve already written a script to send a confirmation e-mail to the recipient “On Form Submit.” So I’m comfortable with the MailApp.sendEmail class.

And if you notice the “Updaid” tab, you’ll see that I’ve tackled using a query to pull out people who haven’t paid.

But I’m not sure how to get the MailApp.sendEmail class to operate on data that’s already IN a sheet. That is not triggering automatically when the form is submitted.

And I don’t know how to adapt my query to account for the 10 days ago bit.

And I’m not even sure I should be USING a query for this application.

Can anybody right my path?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:59:12+00:00Added an answer on June 7, 2026 at 7:59 pm

    The easiest way to know if a date is 10 days later is probably to count the milliseconds !

    I know it sounds like a joke but it isn’t 😉

    Example :

    function test(){
    var today = new Date();
    var tendaysBefore = new Date(today.getTime()-10*24*60*60*1000);// 10 times 24 hours
    Logger.log(today+' is 10 later than '+tendaysBefore);
    }
    

    The method getTime() returns the number of milliseconds from the reference date, it will work till 2070 so I guess it is safe to use for now 😉

    The trigger issue is already solved in Cornelius’s answer, thx

    EDIT : here is a possible code to do what you want : (tested on your sheet)

     var sh = SpreadsheetApp.getActiveSheet();
     var ss = SpreadsheetApp.getActiveSpreadsheet();// replace these with openbyId''ID') and getSheetByName(name) when you run it with trigger since the sheet wil be 'closed'
     var lastrow = ss.getLastRow();
    
    function onOpen() {
      var menuEntries = [ {name: "check late paiments", functionName: "test"},
                          {name: "send mails to tagged users", functionName: "mailunpaid"},
                                         ];
      ss.addMenu("custom functions",menuEntries);// custom menu
      } 
    
    function test(){ // check column D and set it to "no" if not paid
         var paidcol = sh.getRange(2, 4, lastrow-1, 1).getValues();//read only col D
         for(nn=0;nn<paidcol.length;++nn){
           if(paidcol[nn][0].toString().toLowerCase().match('yes')!='yes'){
           paidcol[nn][0]='no'
           }
           }
          sh.getRange(2, 4, lastrow-1, 1).setValues(paidcol);// write back to sheet
          }
    
    function mailunpaid(){
         var data = sh.getDataRange().getValues();//read the whole sheet in an array, col D is idx3, timestamp is idx0 email is idx 23 
         var today = new Date();
         var tendaysBefore = new Date(today.getTime()-10*24*60*60*1000);// 10 times 24 hours
           for (nn=1;nn<data.length;++nn){  // iterate from row 2 to end ie idx 0 to last
        // Logger.log(data[nn][3]+'   '+data[nn][0])
             if(data[nn][0]<=tendaysBefore && data[nn][3]=='no'){
         //    MailApp.sendEmail(data[nn][23], 'subject', 'body'); // you have to define the mail subject & content somewhere ;-) and uncomment when finished your tests
         Logger.log('row '+Number(nn+1)+' = to send because '+data[nn][0])
             sh.getRange(nn+1,4).setValue('SENT');// tag this user to know that mail has been sent to avoid multiple emails
              }
           }
        }
    

    note that I splitted the code in 2 functions for clarity but when it will run as a trigger you should combine both functions in one to get an automatic checking…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that uses google docs and when you submit it will
I have a form that fills in a Google Spreadsheet. One of the columns
I have a form that is capturing data sent from a google LocalSearch API.
I have a form that submit a shopping cart to Google Checkout. The form
Hi. I have a form that I am using for a google map page
I have a form that calls a success message with this code: // Form
I have a Google form that works great. Inside that form i also have
I have Google form that gets filled in by a few users. Works great
I have a form that allows you to preview coordinates via a google map.
We have a form that submits data to various Google Spreadsheets using Zend Gdata.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.