cat /proc/claus

because blogs never go out of style!

Added a guestbook to the blog!

2026 January 12

I have added a guestbook to my blog! Please go sign it!

Why a guestbook?

One of my goals for 2026 was to add a guestbook to this blog.

A guestbook is a page where visitors leave a message to the website's author (me!). They are a bit different from comment sections, specially when it comes to expectations:

  • Comments are expected to be specific for each post, while a guestbook is for the whole site.
  • Comments bring this expectation of replies and conversation, while guestbooks have this feeling of "fire and forget".

So why a guestbook, and not a comment engine? Well, simplicity for one, but also I feel that this blog is small enough that a comment session might be overkill and underused.

But who knows? Depending on how people use the guestbook, I might change things.

How did you make it?

The guestbook I made today is based on the one found at tiny wanderer's website, with several adaptations. Below I explain what I did in detail. You can follow this text while looking at the source of my Guestbook.

The overall flow is as follow:

  • Create a form that sends data to a Google Form;
  • Create a Google Spreadsheet that receives and processes the data;
  • Create another Google Spreadsheet to make the data public;
  • Write some Javascript to read and parse the public spreadsheet;

Sending the data to a Google Form

If you create a Google Form, it is possible to send data to it by writing an HTML form where the fields have the same names as the ones in the Google form. The Google Forms HTML Exporter makes the process easy.

Processing the Form Data

You can easily link the Google Form to a Google Spreadsheet that will hold the responses. I added a few processing steps in the spreadsheet:

  • In the "FormResponses" sheet, I added a final column "Approved", where I can mark the comments that are ready to show in the blog.
  • I configured the spreadsheet to send me an e-mail when there are new entries (Tools -> Notification Settings -> If form submitted then sent e-mail).
  • I created a second sheet that copies only the approved data from the response sheet, using filter():
=filter(FormResponses!A2:D98, FormResponses!E2:E98 = "OK")
  • In the second sheet, I did a little bit more processing, such as changing the date format, etc.

Adding another Google Spreadsheet to make the data public

Using the Google Spreadsheets API, you can download a CSV with the contents of a sheet, which I want to parse into my Webpage. Problem is: To allow that, I need to make the Spreadsheet public, and that would show the non-approved comments too.

So I had to make a second, public spreadsheet, and import the Sheet with the postprocessed comments. You can do this using the IMPORTRANGE() function:

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/[[Hidden Spreadsheet]]", "Guestbook!A1:C100")

Parsing the public spreadsheet with Javascript

The final step is to get the data using fetch on the public spreadsheet, and then parse the resulting CSV file. You can see the javascript for that directly on the Guestbook Page, by using "view source" on your browser. I did my best to make the code readable!

What is next?

I'm happy to have a Guestbook in my webpage now, but I'm not yet 100% satisfied. A wishlist for the future:

  • bug: The current implementation can't handle comments with line breaks. Right now I have to edit them out when approving comments.
  • I want to get this out of the Google ecosystem. I should be able to replace google docs with local files in my server, but I'm a bit worried about security implications. A project for Golden Week, maybe?
  • Eventually, I'd like to implement webmentions. This would allow all sorts of cool stuff. A neat tutorial on Webmentions.

That's it, Please leave a comment on my Guestbook!.

Tagged: #guestbook, #javascript, #google, #blog, #hacking,