This guide takes a finished instrument to a live, public survey that writes responses into a Google Sheet. Every step is free, and the survey itself is a single HTML file that runs in any browser with no server.
The deployment has three parts.
You can do all of this from the SurveyBuilder without writing R, or from R with two function calls. Both routes produce the same files.
.sframe file from the
SurveyBuilder or an sframe object in R.Create an empty Google Sheet. The collector adds a
Responses tab with the correct column headers on the first
submission, so you do not prepare the sheet by hand.
Generate the Apps Script collector. From the SurveyBuilder, open
Survey settings, choose the Google Sheets tab, paste your Sheet URL, and
click Download collector (.gs). From R, call
export_google_sheet().
study <- read_sframe("my_study.sframe")
export_google_sheet(
study,
sheet_url = "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID",
output_dir = "."
)Both routes write surveyframe_collector.gs. The file
contains one column per question, plus respondent_id,
started_at, and submitted_at. Matrix,
multiple-choice, and ranking questions expand into more than one column:
a matrix gets one column per row, a multiple-choice question gets one
0/1 column per option, and a ranking question gets one column per option
holding its rank.
surveyframe_collector.gs,
replacing any existing code, and save.Sheets. The collector refuses a response rather than risk
changing its values when this service is unavailable./exec.This URL is your collection endpoint. Keep it for the next step.
The exported survey posts each response to whatever endpoint it carries. Set the endpoint before you export.
From the SurveyBuilder, paste the Web App URL into the Apps Script
Web App URL field on the Google Sheets settings tab, then click
Export survey. From R, store the URL on the instrument
and call export_static_survey().
study$render$google_sheets_endpoint <-
"https://script.google.com/macros/s/YOUR_SCRIPT_ID/exec"
export_static_survey(
study,
output_path = "index.html",
open = FALSE
)The result is a single HTML file. When an endpoint is configured, the
browser sends the row to Google Sheets. Because this is a cross-origin
no-cors request, the page can confirm only that it sent the
request. Google’s acceptance stays unconfirmed from the page’s side.
Depending on the instrument’s thank-you settings, the page also offers
the respondent a CSV download, which becomes a real backup once the
respondent actually saves it. Pilot the complete route and check the
stored row before inviting participants.
Name the file index.html if you plan to host it at the
root of a site, because most hosts serve index.html as the
default page.
GitHub Pages serves static files straight from a repository.
my-survey.index.html to the repository. Use the web
uploader at Add file, then Upload files, or push with git.main branch and the / (root)
folder, then Save.https://YOUR_USERNAME.github.io/my-survey/.Share that link. To update the survey, re-export the HTML and upload it again over the old file.
Blogger can serve a survey inside a page.
index.html to any static host first (GitHub Pages or
Netlify Drop), then embed it:<iframe src="https://YOUR_USERNAME.github.io/my-survey/"
style="width:100%;height:1200px;border:0"></iframe>The iframe approach keeps the survey self-contained and avoids conflicts with the Blogger theme. The same iframe works in Google Sites, WordPress, and most content systems.
Once responses arrive in the Sheet, pull them into R for analysis. Use the Sheet ID or full URL.
responses <- read_sheet_responses(
sheet_id = "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID",
instrument = study
)
qr <- quality_report(responses, study, respondent_id = "respondent_id")The returned data frame is validated against the instrument and is
ready for quality_report(), score_scales(),
reliability_report(), and
run_analysis_plan().
Editing the instrument changes what respondents see and may change
the column set. Keep one instrument version per study: record the change
with amend_sframe(), retain the earlier instrument, and
identify which version each respondent received. Prefer a new response
tab or Sheet for a materially changed instrument. When you add, remove,
or rename questions:
Existing rows remain, but they were collected under the earlier instrument, so treat a comparison across the change as needing its own justification. Pilot the revised survey and confirm its headers and stored values before reopening it.
Sheets.=, +, -, or
@.read_sheet_responses() returns that row in R.