& custom functions in Google Sheets
My planner is on Google Sheets and divided into several sub-sheets, or tabs. The first tab is the setup tab, letting me input my major and starting year. The next tab, Classes, is a space for me to write down notes on potential classes. The Pathways tab is how I planned my Gen Eds, and the Transfer Credits tab provides a place to input those. Most importantly, I have a tab for each of my four undergraduate years, to input all of my classes and grades.
At first, I input the grade that I got in a class by converting letters to points manually. For the planner to do that for me, I wrote my first GAS (Google Apps Script) function in JavaScript. This made a lot of calls to the server (one per class), so I made a wrapper function that took an array of grades and now it only makes two calls to the server.
If/Else Shorthand in JSTo calculate a cumulative GPA I simply take in the current year as a parameter to my function. This means that once I graduate, I can still see my freshman year GPA. If the currentYear value is two, then I will discount all credits and grade-points from the subsequent years.
To calculate in-major GPA, I take in the major key as a parameter, and then parse the class codes for that key. So if your major key is "CS" and your class is "CS 2114" then this will register as an in-major class. Once I have all valid in-major credits and points, I can calculate the cumulative GPA in the same way I did before.