Published: 2024-05-22 Last Update: 2024-05-29

This is how you clock-in in Google Sheets

In Google Sheets, create a sheet named timesheet. The sheet name, not the spreadsheet name. See the image below. timesheet sheet

Put these exact headers (can be in any order you want), starting from row 1 column A.

  • id
  • key
  • employee_id
  • type
  • date
  • time
  • day
  • latitude
  • longitude
  • lat_long

Example: example sheet

For context, the key here is a key that is assigned by Google to a specific Google Account. You can use this as an added unique identifier to the employee ID that will be entered by the user who clocked in. Just take note that this key will change every 30 days. You can read more about is here.

In addition, the latitude and longitude will only have values if the employee who clocked in enabled his/her location service. Otherwise, they would just be empty.

Click Extensions > Apps Script. extensions apps script

You will see a screen like this. This is a Code.gs file where we can put Apps Script codes. apps script code.gs file

Copy the code from this Code.gs file and replace everything in your Code.gs.

Your Code.gs file will now look something like this. apps script new code.gs file

Create an index.html file. create html file

Name it index. index file name

You now have a new index.html file. index file name

Now, copy the code from this index.html file and paste it in the index.html file you’ve created. Take note to replace the existing code.

On the upper right, click Deploy > New deployment. deploy

On the pop-up window, click the gear icon, then select Web app. new deployment

Enter any Description you like, keep Execute as as Me, change Who has access to Anyone with Google Account, then click Deploy. deploy

Wait for the deployment to finish, then click Authorize access. authorize access

Login to your Google account. Take note that the title of your Apps Script project will show here. google account login

Click Advanced. advanced

Click Go to <project-name> (unsafe). unsafe link

Take note that the above is fine even if it says not verified or unsafe. It’s your apps script, so it’s fine.

Read the permissions that you will allow (might not be the same as the screenshot) before proceeding. Then click Allow. allow

If you encounter any error, just try to deploy again.

When successful, you’d get your URL. Click it to open your new web app. new deployment url

If all is well, congratulations! You now have a clock-in system using google sheets. new web app