DEV Community

kashif-imran
kashif-imran

Posted on

Use Google docs for Journaling

There are a ton of articles which speak about the benefit of journaling, here i am going to write about how you can use google doc script feature to use google docs for journaling.

Step 1: Login to your google account and create a google doc sheet. Lets name it Journal and save it

Step 2: On the toolbar goto Tools -> Script editor

replace the function with the function below


function onOpen() {  
  var doc = DocumentApp.getActiveDocument();
  var body = doc.getBody();
  var date = Utilities.formatDate(new Date(), "IST", "dd-MMM-yyyy hh:mm:ss");    
  doc.getBody().appendParagraph('Date: ' + date);
  var paragraph = doc.getBody().appendParagraph('');
  var position = doc.newPosition(paragraph, 0);
  doc.setCursor(position);
}

name the project as DateOnOpenDoc and save it

Step 3: Now click on run icon on the tool bar, google will ask you for permission to run the app. Click allow on the set of pages you get ahead.

Now if you see in the google doc sheet, you can see current date and time printed on the sheet

That's it guys. You have created a simple journaling app for yourself. Totally free of cost

From now on every time you open the google doc you will see current date and time printed on the sheet. This will help you track your daily thoughts and organise your life

Top comments (1)

Collapse
 
mackkormick profile image
kalabonkes

Is it Academized a safe writing service for me? I want to get more information about this company and its writers. Who will tell is Academized legit?