Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Email From a Google Sheet: Claim the Row Before You Send It

Every guide to sending email from a Google Sheet ends with the same safety rule: write SENT next to each row after you mail it, so a rerun skips what already went out. The rule is right, and on its own it does not stop a double send. It stops the next run from repeating the last one. It does nothing about two runs that are reading the sheet at the same time. That happens more easily than it…

When sending email through a Google Sheet, a crucial safety tip is to mark each row as SENT after it has been mailed. This prevents duplicate emails from being sent if the process is rerun. However, this single step is not enough to completely prevent double sends. Concurrent runs of the function that installs the automated email trigger can cause issues.

If the function is executed twice at the same time, both will attempt to read the sheet before the first run has marked the row as SENT. This results in the same recipients receiving the email twice, and the sheet remains clean.

To address this problem, an additional layer of protection is needed. The recommended solution involves creating a state system for each row, where it must change its status to claim it before actually sending the email. There are four possible statuses: blank (not sent yet), SENDING (claimed, outcome not recorded), SENT the sender accepted it, and FAILED: reason the sender rejected it.

When a row moves to the SENDING status, a script lock is employed to prevent other runs from accessing the sheet simultaneously. After setting the status to SENDING, the SpreadsheetApp.flush() method is called to ensure that the change is written to the sheet immediately, rather than being stored in pending writes. This process helps ensure that only one run will successfully send the email, while the others either skip or record a failed attempt.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Hi Everyone!

I'm Shivangi. I joined DEV Community to document my learning, share my project updates and connect with fellow developers and professionals. Excited to be a part of this community!

Website Redesign: 7 Signs Your Business Website Needs a Refresh

A website redesign is one of the best investments a growing business can make, but knowing when the time has come is not always easy.

  • Difficult to use on phone, requiring zooming and struggling with buttons
  • Pages take too long to load, frustrating visitors and harming SEO
  • Design no longer reflects current business, outdated brand representation

From ClasseViva to Home Assistant: a dashboard architecture in practice / Da ClasseViva a Home Assistant: architettura di una dashboard in pratica

English Italiano The challenge ClasseViva presents school information across different screens. CVV Dashboard brings averages, grades, noticeboard messages, agenda events, teacher annotations…

  • ClasseViva displays school data across screens
  • CVV Dashboard creates integration and Lovelace card
  • Lovelace card auto-discovers entities, displays various data types

React state has no type of its own. I gave it one, and it compiles away

In Vue, Solid, and Angular, state has a type of its own: Ref , Accessor , Signal . In React, the count from useState is just a number .

  • React preprocessor introduces Reactive T for reactive state
  • Derived T represents computed state from Reactive T
  • Todo component demonstrates reactive state management

More from Thursday, 15 October 2026 →