πŸ“Š Google Sheets Export

Paste your Google Apps Script Web App URL below. Records export automatically every day at 6pm EST. Setup guide ↓

πŸ’Ό Paylocity Configuration
Employee ID Mapping β€” Map each worker token to their Paylocity Employee ID.
Worker tokens are used as Employee IDs if no mapping is set.
Job Code Map (auto-generated from shift type)
contract β†’ CNTR  |  temp-to-perm β†’ T2P  |  temp β†’ TEMP
permanent β†’ PERM  |  gig β†’ GIG
Senior Data Engineer β†’ SR-ENG  |  Barista β†’ BARISTA  |  Admin β†’ ADMIN-ASST
⏱ Overtime logic: Shifts > 8 hours get earning code O (Overtime) for the excess hours, with a separate R row for the first 8. Shifts ≀ 8h use R only.
Timesheet Records
Select a date range and click Search
⏰ Auto-export runs daily at 6:00 PM EST. Last export: Never
βš™οΈ Google Sheets Setup Guide
Step 1 β€” Create a Google Sheet
Go to sheets.google.com β†’ New spreadsheet β†’ Name it "MMS Timesheets"

Step 2 β€” Open Apps Script
In your sheet: Extensions β†’ Apps Script β†’ paste the code below β†’ Save β†’ Deploy β†’ Web app β†’ Execute as: Me β†’ Who has access: Anyone β†’ Deploy

Step 3 β€” Copy the Web App URL
After deploying, copy the URL and paste it above.

Apps Script Code:
function doPost(e) {
  try {
    var data = JSON.parse(e.postData.contents);
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
    
    // Add headers if sheet is empty
    if (sheet.getLastRow() === 0) {
      sheet.appendRow(['Date','Worker Token','Worker Name','Shift Title',
        'Employer','Clock In','Clock Out','Hours Worked',
        'Pay Rate','Total Pay','Job Type','Location','Shift ID','Export Date']);
    }
    
    var rows = data.records || [];
    rows.forEach(function(r) {
      sheet.appendRow([
        r.date, r.worker_token, r.worker_name, r.shift_title,
        r.employer, r.clock_in, r.clock_out, r.hours_worked,
        r.pay_rate, r.total_pay, r.job_type, r.location,
        r.shift_id, new Date().toISOString()
      ]);
    });
    
    return ContentService.createTextOutput(
      JSON.stringify({success:true, rows_added: rows.length})
    ).setMimeType(ContentService.MimeType.JSON);
  } catch(err) {
    return ContentService.createTextOutput(
      JSON.stringify({success:false, error: err.message})
    ).setMimeType(ContentService.MimeType.JSON);
  }
}

function doGet(e) {
  return ContentService.createTextOutput('MMS Timesheet Webhook Active')
    .setMimeType(ContentService.MimeType.TEXT);
}