How to Connect Your Own Google Sheets to This Timer

Want to automatically log your focus sessions to your own Google Sheets? Follow these simple steps:

Step 1: Create a Google Sheet

  1. Go to Google Sheets and create a new spreadsheet
  2. Name it whatever you like (e.g., "Focus Timer Log" or "Productivity Tracker")

Step 2: Add the Apps Script

  1. In your Google Sheet, click Extensions → Apps Script
  2. Delete any existing code and paste this:
javascript
function doPost(e) {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var data = JSON.parse(e.postData.contents);
  
  // Add headers if this is the first row
  if (sheet.getLastRow() === 0) {
    sheet.appendRow(['Date', 'Time', 'Work Description', 'Duration', 'Timestamp']);
  }
  
  sheet.appendRow([data.date, data.time, data.work, data.duration, data.timestamp]);
  
  return ContentService.createTextOutput(JSON.stringify({result: 'success'}))
    .setMimeType(ContentService.MimeType.JSON);
}
  1. Click Save (the disk icon)

Step 3: Deploy as Web App

  1. Click Deploy → New deployment
  2. Click the gear icon ⚙️ next to "Select type" and choose Web app
  3. Set these options:
    • Execute as: Me
    • Who has access: Only myself (or "Anyone" if using on multiple devices where you're not logged in)
  4. Click Deploy
  5. Copy the Web app URL that appears

Step 4: Update the Timer Code

  1. Find this line in the timer code:
javascript
const GOOGLE_SHEETS_WEBHOOK = 'PASTE_YOUR_URL_HERE';
  1. Replace 'PASTE_YOUR_URL_HERE' with your Web app URL

That's it! Your focus sessions will now automatically save to your personal Google Sheet with date, time, work description, and session duration.

Troubleshooting

  • Not saving? Make sure you copied the entire webhook URL
  • Permission denied? Check that you set "Execute as: Me" in the deployment settings
  • Want to use on multiple devices? Set "Who has access" to "Anyone" (your URL is still private)