top of page
Search
Writer's pictureKarolina Osiak

Journaling & Google Scripts. A love story



Sometimes tiniest changes end up having a huge impact on our lives (which my Eastern European mind likes to call salting the potato effect*).


Last year, I decided to start journaling. As a part of my morning ritual, somewhere between designing my perfect oatmeal and groaning over my Flying Pigeon* (*yoga position) not being able to take off, I would take 5 minutes to write.


Every day I would ask myself 4 simple questions to start off my day.


  1. What am I feeling right now?

  2. What do I need to hear right now?

  3. What do I want to focus on today?

  4. What am I grateful for today?


Simple questions, that were aimed to help me:

  • Identify and label my emotions

  • Soothen my emotions thanks to a positive inner voice

  • Get clarity over my priorities for the day

  • Bring awareness toward gratitude


A few weeks in, I was hooked, and the impact of journaling on my mood was becoming more and more tangible. There was only one thing that was driving me crazy. My journaling set-up. I started a Google doc as my Journal, and every day I would write today’s date and copy-paste the 4 questions. So I asked myself: why not look into ways of automating that? The only problem? I don’t know how to write App Scripts.


However, ChatGPT knows and I can read Google’s documentation! So together with my new buddy, ChatGPT, we created a small, simple piece of code that generates these four questions in my Google doc. Afterward, I set up a trigger in my Google Doc that every day fires my code and adds the journaling prompts in the morning (sometime before I finish my downward-facing dogs).


Looking back, having a routine like this opened my eyes to my inner world and helped me get out of the fast-paced train of the day-to-day and redirect my attention to what really mattered. It is a practice that I continue up to today (today I answered the question What do I want to focus on today? With “Finally write that article about journaling prompts!) and I daily see the positive impact on my well-being.


Since it works for me, I thought I would also share with you how to set up your own Journaling Google Doc in case it also helps you. Fear not, it is easy peasy lemon squeezy. Below you can find a walk-through of the steps you can take to create your own automated Journaling Google Doc.


  1. Create a Google Doc and name it ie “Journaling”

  2. Open the script editor by selecting "Extensions" > "App Script" from the menu in your Google Doc.

  3. Paste the createTextBlock() function code into the script editor. You can edit the text variable as desired to contain your questions.



function createTextBlock() {
  var doc = DocumentApp.getActiveDocument();
  var date = Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "MM/dd/yyyy");
  var text = date + "\nWhat am I feeling right now?\nWhat do I need to hear right now?\nWhat do I want to focus on today?\nWhat am I grateful for today?";
  var paragraphs = doc.getParagraphs();
  var existingTextBlock = false;
  for(var i=0; i < paragraphs.length; i++){
    if(paragraphs[i].getText().includes(text)){
      existingTextBlock = true;
      break;
    }
  }
  if (!existingTextBlock) {
    var paragraph = doc.getBody().insertParagraph(0, text);
    paragraph.editAsText().setItalic(true);
  }
}

  1. You can test your function by clicking “Run” in the menu slightly above your script. Your questions should pop up in your “Journaling” document.

  2. Save the script using the save button in the menu slightly above your script. It will save it as createTextBlock.

  3. Click on the "Triggers" icon (the clock) in the left-hand menu.

  4. Click the "+ Add Trigger" button.

  5. Choose the following settings:

    1. Choose the function to run: createTextBlock

    2. Choose the deployment: Head

    3. Choose the event source: Time-driven

    4. Choose the type of time-based trigger: Day timer

    5. Choose a time of day: Choose a specific time (e.g. 8-9am)

  6. Click "Save".


Et, voila! Now, your Journaling Google doc will be updated every day at the specified time with your journaling prompt. While the simple technology on its own cannot ensure you benefit from the practice of journaling, it can make the journaling process as smooth and enjoyable as possible. And with time, you should be able to see how consistent journaling can lead to personal growth, reduced stress, and increased happiness.


So why not give it a try and see the impact that journaling could have on you? Who knows, you might just uncover the next great novel buried within your daily musings!


* Potatoes without salt? They taste like nothing! Potatoes with salt? An exquisite experience made for your divine taste buds


8 views0 comments

Recent Posts

See All

Comments


bottom of page