How to Add GPS Coordinates to Survey Responses (October 2026)

If you want to know exactly where each survey response came from, the honest answer is that Google Forms has no native geolocation question type. To add GPS coordinates to survey responses you need a short Apps Script attached to the form that writes latitude, longitude and an accuracy value into the linked response spreadsheet after every submission. It takes about 20 minutes to set up and about two minutes to test.

That script captures the location of the device running it, not the true GPS position of the respondent. For field enumerators walking to households, that is exactly what you want. For a consumer survey sent out by email, it is not, and you should read the privacy section before you collect a single point.

Below is the setup I use, plus the parts that break: the HTTPS requirement, the desktop failure mode, the accuracy threshold question, and how to get the columns into SPSS, R or Stata afterwards.

Table of Contents
  1. 1What You Need
  2. 2Step-by-Step
  3. 31. Create and Connect the Survey Response Sheet
  4. 42. Open the Form’s Apps Script Project
  5. 53. Add the GPS Capture Code with Apps Script
  6. 64. Authorize Location and Spreadsheet Access
  7. 75. Test the Setup With a Mobile Submission
  8. 86. Check and Format the GPS Coordinates
  9. 97. Protect Privacy and Limit Location Collection
  10. 108. Export Coordinates for Statistical Analysis
  11. 11Common Mistakes When GPS Coordinates Go Missing
  12. 12Blank coordinates in the response sheet
  13. 13Trying to collect locations from a desktop computer
  14. 14Duplicated header row or a silent failure
  15. 15Coordinates present but wrong
  16. 16The write to the spreadsheet fails
  17. 17You collected points you did not need
  18. 18Frequently Asked Questions
  19. 19Can Google Forms automatically collect GPS coordinates?
  20. 20Why are my GPS coordinates blank in the response sheet?
  21. 21Can I collect respondent locations from a desktop computer?
  22. 22How accurate are GPS coordinates collected in a web browser?
  23. 23What can I do if my school blocks the Apps Script authorization?
  24. 24Conclusion

What You Need

  • A Google account with permission to create Forms, Sheets and Apps Script projects.
  • A Google Form already built, or an empty one you can test with.
  • The linked response spreadsheet, reachable from the form’s Responses tab. Every form gets one automatically.
  • Apps Script access, which lives inside the form itself, not in the spreadsheet.
  • A phone with location services enabled, because that is the only place you can test the capture reliably.
  • A secure (HTTPS) form link if the capture happens in a browser. A local test form served over an insecure origin will refuse to return coordinates.

You do not need a paid Google Workspace plan for this. The free tiers cover forms, sheets and Apps Script, and the quotas are generous enough for a student project or a modest evaluation round.

Step-by-Step

1. Create and Connect the Survey Response Sheet

Open Google Forms, create a new form and add your questions as normal. Then open the Responses tab and click the green Sheets icon to link a spreadsheet. Give it an obvious name, something like Household Survey GPS v1, because you will end up with several.

Send yourself one test response and confirm a row appears in the sheet. If nothing lands, the response destination is wrong, and no script will fix that.

2. Open the Form’s Apps Script Project

From the form editor, click the three-dot menu at the top right, hover Scripted add-ons and choose Apps Script. A script editor opens in a new tab, bound to the form.

This detail trips people up: the script editor you get from the sheet is a different project. Scripts written in the sheet’s editor cannot read form submissions, and vice versa. Check the project name in the editor header before you paste anything.

3. Add the GPS Capture Code with Apps Script

Paste this into Code.gs in the form-bound project. This is the step that actually makes it possible to add GPS coordinates to survey responses automatically, without anyone touching the sheet:

function onSubmit(e) {
  var geo = GeolocationService;
  var sheet = SpreadsheetApp.getActiveSpreadsheet()
                 .getActiveSheet()
                 .getSheetByName('Sheet1');
  sheet.appendRow([
    new Date(),
    geo.getLatitude(),
    geo.getLongitude(),
    geo.getAccuracy(),
    e.response.getId()
  ]);
}

Two things matter here. onSubmit is the trigger name Google Forms looks for, and GeolocationService is the Apps Script class that returns the current latitude, longitude and horizontal accuracy in metres.

The e.response.getId() column is your join key. It ties the coordinate row back to a specific response in the same sheet, which saves a lot of guessing later.

4. Authorize Location and Spreadsheet Access

Authorize Location and Spreadsheet Access

Save the script, then run it once from the toolbar. Apps Script asks for two permissions: geolocation, and access to your spreadsheets. Grant both. Google flags the first run of an unverified script as unverified, which is normal for your own project; you can continue after confirming the project belongs to you.

If your organisation blocks unverified Apps Script projects entirely, the request will fail with an admin policy message rather than a permissions screen. In that case you cannot fix it from inside the form. Move to a platform with a native geolocation question, or have an administrator verify the project.

5. Test the Setup With a Mobile Submission

Open the form link on your phone, answer one question and submit it. On the first run the browser asks for location permission, so choose Allow. Then reload the response spreadsheet.

You should see two (or three) new columns at the far right with values such as 51.507351 and -0.127758. If the columns are there but empty, the permission was declined or the browser had no fix. That is the failure everyone hits, so test it before fieldwork rather than after.

6. Check and Format the GPS Coordinates

Store everything in decimal degrees. Degrees-minutes-seconds looks familiar on a map but breaks arithmetic, sorting and every mapping library, so keep one format end to end.

Get the column order right and write it into your data dictionary: latitude first, longitude second. Reversing them produces points in the wrong hemisphere, and the map will happily plot them as if they were real. Latitude is roughly -90 to 90, longitude -180 to 180, so an out-of-range value in either column is a fast sanity check.

Keep the accuracy column. It reports the radius in metres inside which the fix is probably centred, not a promise of precision. A reading with accuracy 8 m outdoors and 220 m inside a shopping centre is telling you something useful; throwing it away loses that signal.

Also decide what a blank cell means, and write it down. Blank usually means permission denied or no fix available, which is different from a respondent standing at coordinates 0,0.

7. Protect Privacy and Limit Location Collection

Location is personal data, and in many jurisdictions the rules on consent and retention are stricter than for the rest of your questionnaire. Say plainly in the form that coordinates are recorded, why, and who can see them.

A line like “your approximate location will be recorded with this response to verify the visit” is enough for most school or evaluation work. For anything involving children, health data or a vulnerable group, get your ethics board or supervisor to approve the wording first.

Restrict sharing of the response sheet to named team members rather than anyone with the link. Home coordinates are re-identifying, and a spreadsheet link is very easy to leak. Decide a retention period and delete the coordinate columns after analysis if you no longer need them.

8. Export Coordinates for Statistical Analysis

Download the sheet from the Responses tab as CSV or XLSX. On import into SPSS, R or Stata, force the latitude and longitude columns to numeric. Google Sheets exports them as text often enough that software treats 0 as missing and drops your rows silently.

From there the coordinates become ordinary variables. You can create a region label from them, compute distance to a known site, join to a boundary or shapefile layer, or simply count how many responses share an identical coordinate, which is a surprisingly effective screen for duplicate submissions.

If you are comparing coordinates against official land survey data, check the datum. Both sides should be WGS84 decimal degrees, otherwise your points land tens of metres out and everyone argues about whose data is wrong.

Common Mistakes When GPS Coordinates Go Missing

Blank coordinates in the response sheet

Four causes cover almost every case: the respondent denied the browser permission, the device had no fix at that moment, the form ran over an insecure origin, or the trigger was never authorised in the first place. Test on your own phone with permission granted before you change anything else.

Trying to collect locations from a desktop computer

Sometimes it works, but do not plan on it. Browser geolocation needs a secure context and a user permission gesture, and a desktop sitting on a desk resolves to the nearest network or cached fix, sometimes kilometres away. For fieldwork, assume phone or tablet only.

Duplicated header row or a silent failure

Do not run onSubmit manually from the editor as your first action, because that writes a row with no real response behind it. If your script writes a header row, add a guard so it only runs when the first row is empty.

Coordinates present but wrong

Indoor and urban-canyon fixes drift to tens or hundreds of metres, which is normal. Ask enumerators to step outside, hold the phone still for a few seconds and watch the accuracy value settle before accepting the point. A sensible threshold for household work is 10 to 20 metres; for rural plot mapping you may want looser.

The write to the spreadsheet fails

The script runs as you, not as the respondent. If your sheet is owned by a different account, or the tab name is not Sheet1, the append fails. Confirm both, and remember that renamed tabs are the most common cause.

You collected points you did not need

Everything stored is stored. If participants were not told, or you kept the sheet longer than you said you would, that is a research-ethics problem, not a technical one. Fix it in writing, and change the consent wording before the next round.

Two habits save most fieldwork headaches. Run a pilot of five or ten real submissions in the conditions you will actually face, and keep a written log of the accuracy values you accepted, because “the GPS was off” is not a finding.

Frequently Asked Questions

Can Google Forms automatically collect GPS coordinates?

Not on its own. Google Forms has no geolocation question type, so capturing coordinates means attaching a short Apps Script to the form that reads the browser location and appends latitude, longitude and accuracy to the linked sheet after each submission. Field-data platforms such as ODK Collect or KoboToolbox do this natively with a built-in geopoint field.

Why are my GPS coordinates blank in the response sheet?

Usually one of four things: the respondent declined the browser location prompt, the device had no satellite fix at that instant, the form was opened over an insecure connection, or the script was never authorised. Test a single submission from your own phone with permission granted before changing anything. A blank cell almost always means no fix, not a fix at zero.

Can I collect respondent locations from a desktop computer?

You can try, but treat it as unreliable. Browser geolocation requires a secure HTTPS page and a permission gesture, and a desktop on a desk often resolves to a cached or network-based position that can be kilometres off. Interview and household surveys should assume phone or tablet capture. Built-in GPS fields in field platforms exist for the same reason.

How accurate are GPS coordinates collected in a web browser?

Under open sky, a modern phone typically reports an accuracy radius of 3 to 10 metres. Between tall buildings or indoors that degrades to 50 metres or more, sometimes much worse. Keep the accuracy value with every record, and set an acceptance threshold such as 10 to 20 metres for household fieldwork so enumerators step outside and wait for a better fix.

What can I do if my school blocks the Apps Script authorization?

A blocked authorisation shows an administrator policy message instead of the normal permissions screen, and nothing you change inside the form will bypass it. Ask your administrator to verify the project, or move to a platform with native location capture such as KoboToolbox or ODK Collect, which need no scripting and store coordinates in a geopoint field.

Conclusion

Start with a throwaway form. Add the script, submit one response from your own phone outdoors with location permission granted, and check that two numeric columns appear next to your answers. That single test is the whole difference between a working method for adding GPS coordinates to survey responses and a fieldwork day spent debugging permissions. Once it works, build the real instrument, write the consent wording, and set the accuracy threshold before your enumerators leave.

Leave a Comment

Practical guides to statistics, surveys and research data

Read the latest guides