CxD Archive
Code: Trivia App
Code: Trivia App
  • About
  • Prerequisite Knowledge
  • Code Template
    • Template Build Tutorial
      • 1. Screens as Containers
      • 2. Welcome Screen
      • 3. Question Screen
      • 4. Thank You Screen
      • 5. Core JS Functions
      • 6. Load Questions and Go
      • 7. Respond to Answer Clicks
      • 8. Finishing the Game
      • 9. Visual Enhancement
    • Managing the Question DB
  • More
    • Code Mod Examples
      • Style Changes with CSS
      • Support True/False Questions
      • Add "Next Question" Button
      • Add a Category Selection Screen
      • Add Sound Effects on Answer Clicks
      • Add Basic Scoring
      • Add a Question Timer
      • Add a Question Timer with Pause Button
      • Custom Feedback Text for Individual Questions
      • Use Images with Questions
      • Display the Total Question Count at Welcome
      • Add Background Animation
    • Trivia JS Library Reference
    • P5.js
    • ★ Trivia Project Guidebook
Powered by GitBook
On this page
Export as PDF
  1. Code Template

Managing the Question DB

⚠️ Important update to instructions posted August 30, 2021.

Previous9. Visual EnhancementNextCode Mod Examples

Last updated 3 years ago

Using Google Sheet as Database (Recommended)

  1. Login to Google Drive.

  2. Go to .

  3. Create your own copy of the spreadsheet by selecting File > Make a copy....

  4. Now publish your copy of the spreadsheet by selecting File > Publish to the web...

  5. Choose the Comma-separated value option as shown below.

  6. Click the Publish button and copy the full link provided.

    ⚠️ If you are using your school Google account, ensure that you turn off restricting access to your school. If you are using a personal Google account your published link should work fine without needing to do this.

  7. Find the setup() function in your JavaScript file, like the example below, and replace your link as the googleSheetLink.

  8. Now you can edit your Google Sheet and your question database will automatically be updated in your trivia app.

//Runs once at the beginning
function setup() {
  var googleSheetLink = "https://docs.google.com/spreadsheets/d/e/2PACX-1vRYCi4KENeZMlf9JbV8BhVrdOHse2250INSiRo7gEYWUYp3V0jiWFKWcnm1jzx5q1BMsmd9fOopk2Z_/pub?output=csv";
  trivia.loadGoogleSheet(googleSheetLink).then(displayWelcome); 
}
this spreadsheet