Who won what?

A simple program to display election results on a tidy, user-friendly website

After the polls close, voters, candidates, and media representatives start flocking to their local election website to find election results. To respond to this need, election officials strive to publish results in a format that’s simple, easy to understand, and that won’t burden their server.

This tool makes the whole process easier.

Using a Google spreadsheet that you’ve customized for your area and election, you can enter election results that will automatically update in a dynamic display for voters on your website.

What you'll need

  • Computer with internet access
  • Text editing program like Notepad (for PC) or TextEdit (for Mac)
  • Official list of contests on your upcoming ballot
  • FTP program and a server set up to run PHP scripts
  • Your office’s IT professional to transfer files to your website’s server

How it works

Who Won What? makes it easy to display election results to the public. On election night, you enter results into a Google spreadsheet that you’ve customized for your election. When you update this spreadsheet, voters will see the results displayed live on your election website.

Demonstration of how content entered into the spreadsheet appears on the display

Results you enter into your spreadsheet are displayed on the results page

In other words, your Google spreadsheet acts as a “backend,” while the “frontend” will be your new election results display page. There are 3 components that make the tool work:

  • Your spreadsheet, which you keep on Google Drive. You’ll do all your edits right there in Drive, which will automatically save your changes.
  • Your results display page, which takes the form of an htm file that you’ll host on your server
  • A php script file, which you also host on your server, that allows the display to “read” your spreadsheet

How to use it

There are a number of steps to get your election results page off the ground, but fundamentally, there are 3 major things you need to do to use this tool:

Getting started

1. Set up your Google account and download the program files

Using the tool

2. Adapt the spreadsheet to suit the needs of your location and your election

3. Publish the results page and share it with your community

If you’re using this tool for the first time, you’ll need to do all 3 of these things. Follow the instructions below in their entirety.

To use the tool for subsequent elections, you’ll only need to work through 2 and 3 above. That means you can skip to the Using the tool section, adapting the instructions to suit your situation. Begin by checking out the overview provided in the final “Getting ready for a new election” step at the bottom of the Using the tool section.

Ready to get started? Great!

Table of contents

  1. Creating a Google account
  2. Setting up 2-step verification
  3. Downloading the program files
  4. Uploading the template and setting up share settings

Creating a Google account

Since this tool uses Google Sheets as your election results spreadsheet, you need to have a Google account for your election office.

If you already have a personal Google account, you can use it, but it’s better to create a new one for your office. The benefit of an office account is that your colleagues can use it without being able to access your personal information.

If your office already has a Google account, you can skip to setting up 2-step verification.

If you don’t have an office account, start by going to Google’s sign-up page and providing information for your election office.

A user has entered information needed to create a Google account

Create a Google Account

Once you’ve entered your information, go to the bottom right of the page and click the Next step button. A pop-up window will display Privacy and Terms. If you agree, scroll down to the bottom and click the I AGREE button. You’ll then get a confirmation message. Your account is ready.

Setting up 2-step verification

Since election results are important and sensitive, keeping them secure is vital. Google’s program of 2-step verification can help ensure that only you and your most trusted staff members can enter information into the spreadsheet.

Most online accounts are secured with only a password. That’s 1 step. Using 2-step verification, you need to have both a password and a verification code. This extra layer of security helps prevent unauthorized people from accessing your account.

If you already have 2-step verification set up for your Google account, you can skip to downloading the program files.

If not, start by visiting Google’s 2-step verification landing page. Going to the top right, click the Get Started button. You’ll be asked to provide your password. Enter it and click Sign In.

Setting up 2-step verification takes just 3 steps:

1. “Let’s set up your phone”: First, you’ll be prompted to provide a phone number to verify your account. The number you provide should belong to the chief election official. You can choose to receive your confirmation code in a text message or phone call. Enter the number, make your selection, and scroll down to click TRY IT.

A user has entered a phone number to start the two step verification process

Enter your phone number to start the two-step verification process

2. “Confirm that it works”: Google will then ask you to enter the code that it sent. Check your phone, enter the code, and scroll to the bottom right and click NEXT.

3. “It worked! Turn on 2-Step Verification?”: If you entered the code correctly, you’ll get this confirmation, and Google will ask if you’re ready to turn on 2-step verification. Scroll to the bottom right and click TURN ON.

You’ll get a confirmation saying that 2-step verification is on. Google asks you to choose which method you want to use for 2-step verification in the future. You can choose to keep text messaging as your default format, or you may choose another method if you prefer.

And you’re all set! You can simply close the page, or you can keep the page open in another browser tab while you continue preparing the tool.

So what does it mean now that you’ve enabled 2-step verification?

It means that even if somebody knows your account password, or can guess it, or can hack it, they won’t be able to access your account without access to the method you chose for the second step.

But keep in mind, it also means that you, or the staff member who is entering in election results, won’t be able to access the account without both the password and the 2-step verification.

The process verifies the computer that you used to set up 2-step verification, and for 30 days you can log in with this computer using just your password. But be aware that if you use a different device, or after your 30 days have passed, you will need to confirm your account again with 2-step verification.


Downloading the program files

Now that your account is set up and verified, you’re ready to download the files for this tool and get them prepared for your area and your election.

The files are contained in a zip folder. When you click the link below, your download should begin automatically, and the folder will be saved to your default download location.

Download the Vote Results Zip Folder.

Once you’ve downloaded the folder, you’ll need to extract the files.

  • To extract the files on a PC, right-click on the zip file and select Extract All. You’ll be prompted to choose a location. Do so, and then press Extract. Your computer will extract the files and create a new folder.
  • To extract the files on a Mac, you can simply double-click on the zip file, and your computer will extract the files into a new folder.

Now that the files are extracted, you can view the folder’s contents. The folder contains 3 files:

  1. spreadsheettemplate.xlsx is a template for you to upload to Google Drive as the basis for building your results spreadsheet.
  2. voteresults.htm is the results display page. After you upload it to your server, it will display the contents of your results spreadsheet online.
  3. voteresults.php is a script file that links your display page to the spreadsheet. When uploaded to your server, it enables the display page to publish data entered into the spreadsheet.

Once you’ve got your files, it’s time to prepare your results spreadsheet. You’ll return to the files to edit them in a few minutes, but you need to have your spreadsheet ready first.

Uploading the template and setting up share settings

Uploading

The first step to prepare your spreadsheet is to upload the template to Google Drive. Even if you’re experienced with spreadsheets, using the template will help show you how the spreadsheet works with the display page. Later, if you feel the template is constricting, you can totally delete its contents and start from scratch.

Sign in to your Google Drive account.

Depending on whether you’re a frequent user of Google Drive or not, your Drive will either be empty or will contain lots of files and folders. Either way, take a moment to consider where you should upload the spreadsheet template file. You’ll want to put it somewhere you can easily find later.

For example, you may want to create a new folder called “Election Results” to house your spreadsheet template. To do that, go to the top left to click on the NEW button, and in the drop-down box, select Folder.

A user clicks new, then folder, to create a folder

Create a new folder to hold your spreadsheet

You’ll be prompted to name the folder, so type in “Election Results” or a name you prefer. Now, enter the folder by double-clicking it.

You’re now ready to upload the template. Once again go to the top left to click the NEW button, and this time select File upload from the drop-down box.

A user has selected the spreadsheet template to upload

Upload the spreadsheet to your new folder

You’ll be prompted to locate the file on your computer and select it. Do so, and then click Open. Now your template is uploaded to Drive in an easy-to-find location.

Setting up share settings

In order to make it possible for the display page to “find” your spreadsheet, you need to change its share settings.

Start by double-clicking the template file to open it. It opens in Google Drive’s viewer, but you want to view it with Google Sheets, so go to the top center of the screen and click Open with Google Sheets.

There are 3 basic steps to change your share settings:

1. Going to the top right of your screen, click the Share button. In the pop-up that displays, click Get shareable link. This starts the process, but you’re not quite done.

2. In the box in the center of the page, click Anyone with the link can view, and in the drop-down box that displays, click More.

A user has selected Anyone with the link can view and is clicking More

Make the spreadsheet viewable

Then, select On – Public on the web, and go down to the bottom left and click the Save button. Next, click Done.

A user has selected On Public on the web and is clicking Save

Make the share settings “Public on the web”

3. Next, go to the top left and click File to enter the file menu. In the drop-down box, select Publish to the web. In the box that displays, examine the 2 selections, and change the first to read Sheet1. Make sure the second reads Web page. Then, going directly below, click the Publish button.

A user has selected Sheet1 and Web page and clicks Publish

Change your “Publish to the web” settings

You’ll get a message asking you to confirm your selection. Click OK. You can simply exit out of the box that displays your new publish settings.

Concerned about security?

Let’s be clear that “Public on the web” does not mean that anybody can find and edit your election results. This setting just allows the display page to read your spreadsheet so that it can display what you enter into it. Even though it’s “public on the web,” only you — with your Google account, your password, and your 2-step verification — can actually edit the spreadsheet.

Now that your spreadsheet is uploaded and shared, it’s time to adapt the spreadsheet to make it fit your area and your election. This is the first step to truly begin using the tool.

Table of contents

  1. Adapting your spreadsheet for the upcoming election
  2. Entering results by precinct (optional)
  3. Editing the display page files
  4. Transferring the display page files to your server
  5. Testing your display page
  6. Directing traffic to your results page
  7. Reporting results on Election Day
  8. Getting ready for a new election

Adapting your spreadsheet for the upcoming election

At this point you’ve got your Google account set up and you’ve got your spreadsheet uploaded to Google Drive. It’s now time to edit the spreadsheet to get it ready for your election.

You’ll see the spreadsheet template comes with placeholder content. But because every jurisdiction and every election is different, you’ll need to spend some time carefully setting up your spreadsheet so that it includes the right details.

Getting familiar with the spreadsheet

Before you start entering information, let’s just look at the spreadsheet and observe its cells and functions. In your results spreadsheet, each row and column corresponds to a piece of information on the display page.

Display page with text overlay showing how display items correspond to spreadsheet cells

How the spreadsheet cells are displayed on the results page

Row 1 has special functions. It will contain (mostly) static content about your location and the election that will show up in the header of your display page, as you can see in the sample above.

  • A1: Your county or local election authority name (e.g., “Washington County, Michigan”)
  • B1: Your election date (e.g., “November 8, 2016”)
  • C1 and D1: Percent of precincts that are reporting results. Because it’s formatted to add a percentage symbol automatically, C1 should contain number only (e.g., “20”), while D1 contains the explanatory text “of precincts reporting.”
  • E1: Optional cell where you can insert an additional note you’d like to display in your results header (e.g., “Election results are unofficial until certified”).
Close-up of spreadsheet showing functions of row 1

Row 1 contains important header content for your results page

Row 2 and the subsequent rows will contain variable content about the contests on the ballot. Some of the columns are optional items; we’ll point these out along with their functions so that you can decide whether or not to use them.

  • Column A: Optional column to help organize long lists of results. In this column you can put names for individual locales. If you have many contests, with some only pertaining to part of your jurisdiction (a city, township, school district, etc.), you can group them using column A. We’ll look at an example later.
  • Column B: Optional column to help organize long lists of results. Here you can place category headings for contests on the ballot. If you have many contests, you may add headings (“Offices,” “Judicial Retention,” “Referendums,” etc.) to make the display page easier to use. We’ll look at an example later.
  • Column C: Title of each race or contest (e.g., “President”). Titles in this column must be placed to the left of the first candidate name for this race.
  • Column D: Candidate name (e.g., “Elizabeth Cady Stanton”) or available selections (e.g., “yes” and “no”). You may add party affiliation or an abbreviation (e.g., “Rep” or “Dem”) in parentheses after the name if you like. When finalizing results, you may choose to reorder candidates, displaying them in “winning order,” to help signify who won.
  • Column E: Number of votes counted. Along with the number in C1, column E is the only part of the spreadsheet that you’ll regularly update on election night when results come in. The other cells will likely remain unchanged, although you may need to add room for write-in candidates after election night.
Close-up of spreadsheet calling attention to column functions

After row 1, your columns contain details about contests and results

Now that you’ve had an overview of the spreadsheet’s cells and functions, you’re ready to prepare your own spreadsheet.

Entering your information for the election

It’s time to customize the spreadsheet by replacing the placeholder information and adding additional content. To do that, you’ll need to have ballot information for your jurisdiction on hand. Keep in mind that there’s some flexibility in what you enter; if you want to omit a piece of information, you can.

Begin by entering your local details into row 1. For illustration, we’ll be entering fictitious election information for an imaginary place called “Washington County, Michigan.”

In row 1, enter your jurisdiction name and election date. You can’t change the percent of precincts reporting until election night, so leave that as it is for now.

In the optional cell E1, you can enter any additional note that you’d like to display in the header area. Some election offices may want to display a notice about how results are unofficial until certified (see image below). Others may want to add a notice about voter turnout here. You can also leave E1 blank.

Results display shows an added remark reading election results are unofficial until certified

Cell E1 used to add a notice stating results are unofficial

Once you’re done with row 1, start entering information for the biggest races on your ballot. Continue replacing placeholder content with details for your upcoming election.

A user has replaced placeholder content with real election information

Replace placeholder content with details about your election

It won’t take long to discover that you need to alter the template to suit your needs. For instance, if you have only 4 candidates for the presidential race but 6 rows in the spreadsheet, you’ll need to cut 2 rows for that race. Making this change is easy.

If you’re new to Google spreadsheets, you’ll find the following instructions on deleting and adding rows helpful. If you’re a pro, feel free to skim them.

Deleting placeholder rows

We want to delete rows 6 and 7, which have the unneeded placeholder candidates 5 and 6. Going to the left, we’re clicking on row 6 and, holding down the control button on a PC or the command button on a Mac, we’re clicking row 7, too.

Now both rows 6 and 7 are selected, which is evident with the blue highlighting around them. Pressing delete will just delete the content — not the rows, so we instead do a right-click (or two-fingered click, or command + click).

A user selects 2 rows, right clicks, and selects Delete selected rows

First, select both rows, and then delete them

A pop-up box appears, and we select Delete selected rows. Now those unneeded rows are gone.

Of course, you can delete entire races or contests in the same way that you deleted unnecessary rows for candidates. Just highlight the rows corresponding to the race or item that you don’t need, and delete them.

Adding rows for additional candidates and races

What if we have 8 candidates but only 6 rows in the spreadsheet? What if we need to make room for write-in candidates? Adding room for candidates is easy.

To add 2 rows, just highlight 2 rows under which you want to add 2 new ones and do a right-click (or two-fingered click, or command + click). In the drop-down, select Insert 2 below.

Great! Now you’ve got room for the additional candidates.

Alternatively, copying and pasting is a great way to add contests and candidates. If we have 4 judicial retention votes, we can add a fourth race by copying one of the other 3 and pasting it. First, select one of the races, and do a control + C (or command + C).

Keep in mind that, in Google Sheets, pasting does not insert. So you need to make room for your content before you can paste.

Using the instructions above, we add 2 new rows. Selecting the rows, we then do a control + V (or command + V) to paste the content. Now we’ve got that extra judge race that we needed.

Considering columns A and B

Remember that columns A and B allow you to add optional information to help organize and categorize your election results on the display page. As you consider using these, let’s look at how they work.

Column A allows you to separate results by locale in expandable accordion sections on the display page.

A user has entered locale names into column A

Column A allows you to separate results by locale

Cell A2 is intended for “countywide” election results, so it displays with its accordion open by default. Subsequent entries in column A result in closed accordions.

The display page shows countywide results with locale results closed below

By default, countywide results are open and locale results are closed

To open them, you can just click the arrow next to the locale name. The previous accordion will close, and the new one will open.

Now, the display page shows countywide results closed and locale results open

If you open a locale accordion, it expands to display results

If you want to use this function, just enter locale names in column A in the rows that correspond with the start of a new locale.

Column B allows you to categorize races and contests. For large ballots, it can be a helpful way to organize your election results.

A user has added race categories to column B

Column B allows you to categorize races or contests

The text you enter into column B displays as a heading above the contests, and you can use these headings in addition to, or instead of, the locale function of column A.

The display page shows 2 contest categories added

Column B used to categorize contests

Adding links (optional)

Perhaps you’d like to include links on your election results page to give voters additional information about contests on the ballot. Adding links is optional, but it can provide helpful context, especially for ballot measures that voters will likely remember by their topics rather than their numbers or names. A link can remind voters about the measure and clarify what “yes” and “no” votes mean.

To add links, you need to paste this html text into the relevant cell in your spreadsheet, editing the html to replace the placeholder text with your link URL and the contest name with the display text that you want to be linked:

<a href=“INSERT LINK HERE” target=“_blank”>Referendum Title</a>

To insert a link, just add a row under the contest’s heading, so there’s a row between the title and the yes/no selections or candidate names. Then, paste the html text into column D.

A user has added a row in column D to insert a link

Adding a row in column D to insert your link html

Your link will end up looking something like this:

A ballot measure with a link added below its title

Adding links can help you explain ballot measures

Finishing your spreadsheet

That’s about it in terms of the spreadsheet’s functions. Using your official ballot information, you should now be ready to complete your customization of the spreadsheet and enter all the information for your election.

Take your time and don’t worry too much about making mistakes, because it’s easy to go back — at any time — and fix something if you need to.

Entering results by precinct (optional)

Maybe instead of entering result totals into your spreadsheet, you’d instead like to enter results for individual precincts and let the spreadsheet calculate the totals automatically.

This precinct-based spreadsheet format is optional. If you want to enter results by precinct, use the following instructions to adapt your spreadsheet. If you’re happy entering result totals, you can skip to editing the display page files.

Copying races and candidates

With your spreadsheet open in Google Sheets, select the cells corresponding to all the races and candidates that you want to copy. This should consist of columns C and D, starting at row 2 and ending with the row of the last race you’re copying. Copy the text using control + C (or command + C, or by right-clicking, and selecting Copy).

Preparing Sheet2

Then, create a second sheet in your spreadsheet. To do this, go down to the bottom left and click the plus sign. When you do, a second sheet labeled Sheet2 will appear.

A user toggles between Sheet1 and Sheet2

Adding sheets and toggling between them

Your original sheet, Sheet1, will be where your election result totals are tallied, while Sheet2 is where you’ll enter results for your individual precincts. You can toggle between Sheet1 and Sheet2 by clicking the tabs in the bottom left of the screen.

Looking at Sheet2, put your cursor in A2 and paste the races and candidates you’ve copied with a control + V (or command + V, or by right-clicking and selecting Paste).

Now, enter your precinct names or IDs into row 1, starting in column C. All of your precincts will be logged in Sheet2, beginning with cell C1 and extending to however many columns you need. Make note of the last column you use.

In the example below, we added information for 5 precincts, making note that column G is the last column we used.

A user has added columns to make room for 5 precincts

Adding precincts to Sheet2

Freezing columns A and B for reference

As you enter precinct results, you’ll want to keep columns A and B visible for reference. To make it so that these columns stay visible as you move from precinct to precinct, you need to freeze them.

Going to the top left, click the View menu and click Freeze in the drop-down box. Then, in the expanding box, click 2 columns.

A user has navigated to View, then Freeze, and is selecting 2 columns

Freeze the first 2 columns of Sheet2

Now your race and candidate columns will remain visible as you scroll through your precinct columns.

Adding the sum formula for Sheet1

Now you’ll need to enter some formulas into Sheet1 so that your spreadsheet will calculate totals from your precincts. Go to the bottom left of the screen to toggle back to Sheet1.

Start in cell E2, the cell that corresponds to the vote tally for the first candidate in the biggest race. In this cell, enter the following formula, substituting your final column letter in place of the G:

=SUM(Sheet2!C2:G2)

Once you’ve entered the formula, press return or enter. When and if you enter precinct results in Sheet2, the figure calculated in Sheet1 will update automatically.

Copying your sum formula

Now you need to copy your formula into the other cells in Column E. Going to row E, select E2 and highlight every cell from E2 all the way down to include the row corresponding to the last selection for the last contest.

A user prepares to copy the formula by highlighting column E starting at row 2

Copying your formula from E2 to the other cells in column E

With these cells all selected, press control + D (or command + D). This will copy the formula while also adapting it to fit the needs of each row.

Verify that you copied the formula correctly. If you click on cell E8, for instance, the formula should read =SUM(Sheet2!C8:G8), with your last column letter in place of the G.

Testing your precinct spreadsheet setup

Since you probably just have empty cells for each precinct’s vote count for now, you should test your spreadsheet to verify that it properly calculates totals on Sheet1 from your precinct-by-precinct entries on Sheet 2.

To test your spreadsheet, go to Sheet 2 and, in row 8, enter 1, 2, 3, 4, and 5, respectively, as the vote counts for the first 5 precincts. Returning to Sheet1, you should see that cell E8 now displays 15 — the total for those 5 precincts.

If it doesn’t display 15, double-check your entries and, if needed, go back to the formula step above and re-enter your formula for E2 and re-copy it to the rest of column E.

If it did work, go back to Sheet2 and delete your sample numbers to prepare for Election Day.

Setting up automatic percentage computing

You can also automate the process of calculating the percentage of precincts reporting results. This makes things a little easier when you’re entering results on election night.

In Sheet2, go to cell B1 and enter the total number of precincts in your jurisdiction. Cell A1 is where you’ll type the number of precincts from which you have election results. For now, just put 0 in A1.

Returning to Sheet1, you’ll need to put a formula in cell C1 so that it will calculate the percentage of precincts reporting based on the cells you just edited in Sheet2. In C1, enter =ROUND(Sheet2!A1/Sheet2!B1*100) and then press enter or return.

Like with the previous edits, you should go back to Sheet2 and experiment with changing the number in A1 to verify that the number in Sheet1, cell C1 changes automatically.

Precinct info from Sheet2 updates the percentage of precincts reporting on Sheet1

Automatic precinct computing is handy

If it doesn’t, double-check your entries and, if needed, re-enter the formula above.

Using the precinct-based spreadsheet on election night

With Sheet2 prepared and Sheet1 geared up with the necessary formulas, you can update election results on election night using only Sheet2. Fill in the vote counts for each precinct as they arrive, and they’ll be automatically updated in Sheet1 and, therefore, on the election results display page. As precincts report in, change the number in Sheet2–cell A1 to automatically update the displayed percentage of precincts reporting. That’s it!

Editing the display page files

Now that your spreadsheet is set up, you’re almost ready to start displaying election results. But first you need to make some quick changes to the 2 files that power the display page.

To edit these files, you’ll need to use a text editing program.

On a PC, you can use Notepad. You’re good to go.

On a Mac, you can use TextEdit, but you’ll need to change a few settings before you can use it.

To change those settings, open TextEdit, go to the top left and click the TextEdit menu and, in the drop-down box, select Preferences. Under Format, select Plain text.

A user has changed format from Rich text to Plain text

If using TextEdit, change the format

Then, at the top of this window, click the Open and Save tab and, under When Opening a File, select Display HTML files as HTML code instead of formatted text.

A user has changed settings to display html files as code

TextEdit users also should change how html files are opened

Once you’ve done this, you can just close the Preferences window. Now TextEdit is configured for you to edit the display page files.


1. Adding your spreadsheet’s access key to the php file

The first edit you need to make is to set up the php file so that it can access your spreadsheet. Start by going to your spreadsheet and, in the top right, clicking the Share button. In the window that displays, click the Copy link button, which will copy your share link to the clipboard.

Now, open your text editing program and paste the link. What you’ll need to do is identify just the 44-character access key.

A user identifies the 44-character access key in the share link

Identify the access key

Select the key, being careful to select every character but not the slashes on either side, and copy the text.

Now it’s time to paste this key into the php file. Open voteresults.php in your text editing program.

This might require you to right-click (or two-fingered click, or command + click), select Open with, and choose your text editor.

With the file open, identify line 3 and, carefully replacing the placeholder text INSERT YOUR KEY HERE, paste your 44-character access key. Ensure that the quotation marks and the semicolon at the end remain and that your text stays on line 3 without any spaces.

Before and after shows access key has replaced placeholder text

Replace the placeholder text with the access key

Now, save your php file by going to the top left of your text editor, clicking File, and selecting Save. Your php file is ready to go.

2. Customizing your htm file

Now, open voteresults.htm in your text editor. To do so, you’ll need to right-click (or two-fingered click, or command + click), select Open with, and choose your text editor.

There are 2 things you may choose to edit in the htm file.

In line 5, which begins with the <title> tag, you can replace, or add to, the placeholder text “Election Results” by adding your jurisdiction name. This information will appear in the browser tab of your display page.

A user has entered text to change the title in the htm file

Enter a title for your election results page

In line 7, you can edit the refresh rate for the display page. The page is set up to refresh automatically to display results as they’re updated in the spreadsheet. The default refresh rate is once every 2 minutes, but you can replace the number 2 with a different number if you prefer.

For larger jurisdictions expecting a lot of traffic on election night, you might want to replace this with a higher number (of up to 10 minutes) to reduce server load.

A user has identified the number 2 corresponding to the refresh rate

You can edit the refresh rate if you like

Now, save your htm file by going to the top left of your text editor, clicking File, and selecting Save. Your htm file is ready to go.

Now that your display files are edited and prepared, you’re ready to place them on your server so the results page is live on your website.

Transferring the display page files to your server

For this part of the process, we encourage you to get help from your election office’s IT professional. Unless you have experience with posting files to the web using your server, you should get support from a tech colleague for this step.

When you approach your IT staff, explain that you need to upload files to the server, and be sure to have your edited voteresults.php and voteresults.htm files ready on a flash drive or in an email to provide to your colleague.

For the display page to work, your server must be set up to run PHP scripts. Most are, but check with your IT staff member to make sure. Depending on your server type, your IT staff may need additional support or resources to get voteresults.php installed. Election offices with Windows servers, in particular, may find this Microsoft Guide on Installing IIS and PHP helpful.

1. Creating a subdirectory

First, open your website’s FTP program (or your preferred method for transferring files) and log into your server.

Then, create a subdirectory within your web directory called /electionresults or something similar. The name and location of the subdirectory that you create will be part of the URL for accessing the voting results, so choose a name that’s clear, concise, and convenient.

2. Transferring the files

Now, transfer both voteresults.php and voteresults.htm into your new subdirectory. Both files must be contained in the same directory in order to work together.

The php file name must remain the same, but if you want to make navigation easier, you can rename the htm file to the default name for your server to shorten the URL. This default name is often “index.htm” on Apache/Linux servers and “default.htm” on Microsoft servers.

Using one of these default names means that the URL for your display page will look something like www.countyelections.org/electionresults instead of something like www.countyelections.org/electionresults/voteresults.htm.

Once you’re satisfied with the file names, you should be good to go. As you prepare to close your FTP program and test your election results page, take note of its URL. At this point you can thank your IT colleague for helping you, but in a few minutes, after you test your page, you may want to refer them to the instructions below on cache settings.

Testing your display page

Now that your files are uploaded to the server, you should look at the display page live on your site to make sure it works.

Go to your display page URL. If the display page shows the information about your area and your election that you entered into the spreadsheet, that means the connection between your spreadsheet and the display page is working.

If you don’t see the information you put in the spreadsheet, that means there’s a problem in the connection between your spreadsheet and the display page. Go back to review the spreadsheet’s share settings to make sure that it’s published to the web, and try editing the 44-character access key again. Of course, if you make changes to the php file, you’ll need to have your IT professional upload the newly edited version of the file to the server in order for the change to take effect for the display page.

Still not working and need some help? Email us at hello@electiontools.org and we’ll help point you in the right direction.

If your display page appears to be working, go ahead and experiment to see it update your live results. With the spreadsheet open in one browser tab and the display page open in another, change numbers in the spreadsheet (say, change 0 to 1) and watch to make sure they change in the display.

Keep in mind you’ll need to wait the amount of time you specified as the refresh rate. If your page is set to refresh every 2 minutes, you’ll need to wait up to 2 minutes to see your changes displayed. Since updates are automated, pressing “refresh” on your browser won’t update the page.

Illustration shows how numbers entered in the spreadsheet are displayed on the results page

Test your election results page by entering numbers into the spreadsheet and watching them appear on the display

Assuming the live updates are working, you should change the numbers back to 0 so that your spreadsheet will be ready for Election Day.

Technical note on caching

Now that you’ve tested your results page, your IT staff may want to confirm that caching is working on your server. These instructions are optional, but having caching set up can help to lessen bandwidth strain, so you should encourage your IT staff to review these cache settings.

Why does caching matter? It helps minimize the number of times that a request has to be sent to Google for a copy of the current election results. Without caching, your server has to pause to retrieve every update request from Google. With caching set up, requests to Google are sent at most only every 30 seconds, while requests made in the meantime just receive a stored copy of the update from your cache file, cache.txt.

If you’re a small election authority, your results traffic likely won’t exceed Google’s bandwidth limits. But in larger authorities where thousands and thousands of people will access the election results page, it’s possible that Google’s limits could be exceeded if cache.txt isn’t being written.

As a first step, check to see if cache.txt is already being written. After you’ve tested your display page to ensure it’s working correctly, go back to your FTP program and view the subdirectory that houses your results page files. If caching is set up properly, you should find a new file in this directory called cache.txt. If you don’t see it, refresh the directory in your FTP program and check again.

If you see the file, that means that caching is working properly, and you can skip to directing traffic to your results page.

If there’s no cache.txt file, it might be because you need to change your directory’s write privileges so that the PHP is able to write the cache file. To enable caching, you can either change these write settings, or you can edit line 5 of voteresults.php to add a writeable directory path in front of the text “cache.txt.”

If you can’t or don’t want to set up caching, voteresults.php will work even if cache.txt is not being written. Just be aware of the risk of possibly exceeding bandwidth limits.

Whether you enable caching or not, you have 2 additional options for helping to reduce bandwidth strain. 

Lines 7 and 8 of the htm provide additional options for reducing bandwidth strain

Editing the htm provides additional options for helping to reduce bandwidth strain

Editing voteresults.htm, you can change the update frequency in line 7 by inserting a higher number in place of 2, and/or you can change the “alertAt” value on line 8 to a time less than 15 minutes so that you will get fewer update requests from people who set their phones aside or close their computers.

Directing traffic to your results page

Now that your new election results display page is in place, the only thing left to do before Election Day is spread the word about it.

Sample tweet encouraging readers to visit a new election results page

Tell the public about your new results page on social media

As Election Day nears, you should:

  • Place a link to your display page in a prominent location on your website so that visitors can find it quickly and easily
  • Post a link the display page on social media
  • Provide a link to the display page to your local media outlets (newspapers, television, radio, etc.)

Reporting results on Election Day

By Election Day, all of your preparation for the results spreadsheet and display page should be complete. Here are some basic guidelines for using the tool to report election results on election night.

Device setup

For the sake of security, plan to use just one computer to update the results spreadsheet. There’s nothing wrong with keeping the spreadsheet open in your browser as long as you watch the computer and ensure others don’t use it.

Roles

Assign one person to be responsible for entering election results into the spreadsheet. A second person can help verify entries and can enter results if the first person is pulled away.

Updating numbers

Every time you update vote counts, you should also update the percentage of precincts reporting. Keep in mind that the display page is set up so that once this number reaches 100, it will stop automatically updating results.

After the election

You should continue to update the results spreadsheet until you have 100% of precincts counted and results are final.

Days or weeks later, after canvassing, you can update the numbers if needed and leave them up as an archive.

Getting ready for a new election

After a few months have passed and you’ve got a new election to prepare for, you can create a new spreadsheet and display page for the upcoming election while keeping the old ones as an archive.

Spreadsheet

For the spreadsheet, go back to Google Drive and create a folder for the upcoming election, using your folder names to distinguish the elections (e.g., 2016 Primary and 2016 General. Again you’ll need to establish share settings for the spreadsheet and copy the 44-character access key that you’ll paste into the new php file.

Then, you can copy the old spreadsheet and paste it into the new folder, going in to make the necessary edits to adapt your new spreadsheet for the next election.

Display page files

The process for the htm and php files that power your display page is similar. You and your IT professional will need to create a new directory for your new htm and php files, and you can name the older and newer directories to distinguish them (e.g., /2016primary and /electionresults).

You should be able to just copy the older htm file and paste the copy into the new directory, again distinguishing by name if you like. Bear in mind that, as before, the directory and file names that you choose will determine your results page’s URL.

You can’t just copy the php file. Instead, you need to download it, edit it to add the access key for your new Google spreadsheet, and then transfer it to your new directory. And don’t change the name of the php file; it needs to stay the same.