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, with one column per sub-item for
matrix questions, plus respondent_id,
started_at, and submitted_at.
surveyframe_collector.gs,
replacing any existing code, and save./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. Each respondent who submits gets a CSV copy downloaded to their own device, and the same row is posted to the Google Sheet. The two paths are independent, so a failed post never loses a response.
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 the questions, so the column set can change too. When you add, remove, or rename questions:
Existing rows in the Sheet stay in place. New submissions use the new columns.
read_sheet_responses() returns that row in R.