A Google Apps Script project bound to a Google Sheet that calculates mileage between particular campuses and facilities. It includes a numberOfMiles(start, destination) custom function for use in Google Sheets and a ClearForm macro to reset the entry form.
This project is meant to save users time from having to have a separate mileage calculation excel sheet open and inputting data on that sheet for each line in the mileage reimbursement form. This cuts down on the time it takes the user to complete the reimbursement form.
npm install -g @google/clasp- A Google account with Apps Script API enabled
git clone <your-repo-url>
cd mileage-2026The template sheet is included in this repo as mileage-template-2026.xlsx. It contains all the formulas, dropdowns, styles, and merged cells needed for the form to work.
- Go to Google Drive
- Click New → File upload and select
mileage-template-2026.xlsx - Once uploaded, right-click the file and choose Open with → Google Sheets — Google will convert it automatically
- Keep this sheet open; you'll link the Apps Script project to it in the next steps
clasp loginOpen the Google Sheet from Step 2, then go to Extensions → Apps Script. This opens a script project already bound to that sheet. Copy the script ID from Project Settings, then update .clasp.json:
{
"scriptId": "YOUR_SCRIPT_ID_HERE",
"rootDir": "."
}clasp pushA custom Google Sheets function that returns the mileage between two NISD locations.
=numberOfMiles("Adams Hill E.S.", "Clark H.S.")
Both arguments must match a location name exactly as listed in the mileage chart inside code.js.
Clears the input range C16:M29 on the active sheet. It is bound to the keyboard shortcut Ctrl+Alt+Shift+1 and also available under Extensions > Macros > ClearForm.
| File | Description |
|---|---|
code.js |
Main script — mileage lookup function and ClearForm macro |
appsscript.json |
Apps Script manifest — runtime settings and macro bindings |
.clasp.json |
clasp config — links this directory to an Apps Script project |
mileage-template-2026.xlsx |
Sheet template — upload to Google Drive and convert to Google Sheets |
mlgcht2026unlocked.csv |
Source mileage data |
This project was originally conceived and developed by Alvaro Gomez during his tenure at Northside ISD. This public version has been sanitized and refactored. Campus distances will need to be updated in the code.js file before general use.