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.
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:
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
.
You will see a screen like this. This is a Code.gs
file where we can put Apps Script
codes.
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.
Create an index.html
file.
Name it index
.
You now have a new index.html
file.
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
.
On the pop-up window, click the gear icon, then select Web app
.
Enter any Description
you like, keep Execute as
as Me
, change Who has access
to Anyone with Google Account
, then click Deploy
.
Wait for the deployment to finish, then click Authorize access
.
Login to your Google account. Take note that the title of your Apps Script
project will show here.
Click Advanced
.
Click Go to <project-name> (unsafe)
.
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
.
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.
If all is well, congratulations! You now have a clock-in system using google sheets.