Your Cart

Total৳0
Apps Script Tutorial

Build an SMS Attendance Counter with Apps Script

Log incoming attendance SMS messages into a Google Sheet automatically and show a live headcount — no manual entry required.

1Set up your Sheet

Create a new Google Sheet with columns for Name, Roll, Status, and Time. This is where every parsed SMS entry will land.

2Add the Apps Script

Open Extensions → Apps Script and paste the function below. It watches a linked SMS-forwarding webhook and appends a new row for every message received.

Code.gs
// Logs an incoming attendance SMS into the sheet and updates the live counter
function logAttendance(payload) {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Attendance");
  const { name, roll, status } = payload;
  const timestamp = Utilities.formatDate(new Date(), "GMT+6", "HH:mm");

  sheet.appendRow([name, roll, status, timestamp]);
  return ContentService.createTextOutput("OK");
}

3Deploy as a Web App

Deploy the script as a web app with access set to "Anyone," then point your SMS-forwarding tool (or the sample HTML below) at the generated URL.

index.html — live counter widget
<script>
async function refreshCount() {
  const res = await fetch("YOUR_WEB_APP_URL");
  const count = await res.text();
  document.getElementById("counter").textContent = count;
}
setInterval(refreshCount, 5000);
</script>

4Test & go live

Send a test payload, confirm the row appears in your Sheet within seconds, then embed the counter widget on your dashboard or classroom display.