Static, browser-only frontend that fetches a published Google Sheet (CSV) and renders the current week’s mess menu (Breakfast, Lunch, Dinner) as per-day tabs. Auto-selects today when available; no server or build step - update the sheet and the site updates.
| File | Purpose |
|---|---|
index.html |
Main page container; loads styles + Papa Parse + script.js. |
styles.css |
Presentation layer (not shown here; customize branding / responsive layout). |
script.js |
Fetches CSV, parses rows, computes current week range, builds tabs, renders meals. |
Code.gs |
Google Apps Script utilities attached to the Sheet for housekeeping (duplicates + weekly reset + headers). |
Expected columns (row 1 = headers):
Timestamp– Auto-filled by Google Form submission or manual entry; used to determine week range.Day– Full English weekday name: Monday .. Sunday.BreakfastLunchSnacks(optional - currently commented out in frontend)Dinner
The frontend ignores rows whose
Dayis missing or not in the predefined order array.
script.js takes the first row's Timestamp, converts it to a Date, then finds the Monday and Sunday bounding that week. The page title shows: MonAbbrev Day - SunAbbrev Day (e.g., Nov 17 - Nov 23).
Tabs are generated for all days present in the CSV (ordered Monday → Sunday). The tab for "today" (client local time) is auto-selected if that day's data exists; otherwise it falls back to the first available day.
Attached to the Sheet to keep data clean:
deleteOldDuplicateOnFormSubmit(e)- Trigger: On form submit (Installable trigger). Removes any previous row with the same
Dayvalue, keeping only the most recent submission. Adjusts the target insertion row index when deletions occur above it.
- Trigger: On form submit (Installable trigger). Removes any previous row with the same
clearSheetWeekly()- Can be set on a Time-driven (weekly) trigger. Deletes all data rows (preserves header), then calls
setupHeaders()to ensure header integrity.
- Can be set on a Time-driven (weekly) trigger. Deletes all data rows (preserves header), then calls
setupHeaders()- Ensures headers:
Timestamp, Day, Breakfast, Lunch, Snacks, Dinnerand bold styling.
- Ensures headers:
| Function | Trigger Type | Suggested Schedule |
|---|---|---|
deleteOldDuplicateOnFormSubmit |
Form Submit | Immediate (on each submission) |
clearSheetWeekly |
Time-driven | Early Monday (e.g., 00:05) before new menu entries |
setupHeaders |
Manual / part of weekly clear | Only needed after structural changes |
- Open the Google Sheet.
- File → Share → Publish to web.
- Choose the specific sheet tab used for menu data.
- Select "Comma-separated values (.csv)" and publish.
- Copy the generated URL (it will resemble the one in
script.js). - Replace the existing
csvUrlconstant inscript.jsif the Sheet changes.
If you add columns or rename headers, ensure the JavaScript property names match exactly (
Timestamp,Day, etc.).
No build step - just static files.
- Clone repository.
- Open
index.htmlin a browser (or serve via a lightweight static server if needed for CORS experiments). - Ensure the published CSV URL is accessible (test it directly in the browser).
- Edit and refresh.
python3 -m http.server 8080
Open: http://localhost:8080/
Weekly cycle:
- (Trigger)
clearSheetWeekly()runs – old entries cleared. - New submissions arrive through the form – duplicates per Day auto-pruned by
deleteOldDuplicateOnFormSubmit. - Site auto-reflects updates
If triggers misfire, run deleteOldDuplicateOnFormSubmit logic manually by temporarily adapting it into a utility that scans all rows; or just visually prune in the Sheet.
Pull requests welcome. Please:
- Keep changes minimal & focused.
- Update this README if behavior or data shape changes.
- Test with a temporary published test Sheet before merging.
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by Harisankar Binod. Maintained by Software Development Group, NISER.
Questions / improvements? Open an issue.