Ski Trip Spreadsheet Scripting
We have been organizing Itnig ski trips since the beginning. I remember we could fit in a car when we started, then in a pickup van, we later had to rent a couple of cars to be able to go, soon we had to share a bus with other people and now we need an entire bus for us.
Getting people to join
Once you have a date and a location, you can create a form with all the available options and share it via email, Slack, or whatever. We used to create it using Google Forms because it integrated with Google Spreadsheets and was easy to use, but now we use Typeform. It’s beautiful and now also integrates with Spreadsheets.
Calculating each individual price
Our ski trip has a lot of variabilities. One individual might want to rent gear while another one already owns it. Some individuals might want to snowboard and others might want to rent the highest quality skis available. Some need classes and some want insurance. Some people don’t even want to ski, but just spend the weekend in the snow.
This results in a situation where almost everyone has a unique price and although it was easy to calculate and handle when we were 5, it gets harder when you are 50.
You could perform a 200 character long nested IFS function to calculate the price for every row in the Spreadsheet, but it’s easier to just code your own more readable and maintainable Google Script function.
From the ‘Tool’ menu you can access the ‘Script Editor’ and there you have a lot of freedom to write your own functions.
I coded the ‘skiPrice’ function to calculate the final price for every possible combination, depending on the arguments the function received. Once coded, you can call the function as if it was a normal Spreadsheet function, sending cells as parameters.
Sharing the info with the agency
Once you have all this information available you have to share it with the agency so they can check all prices are correct and to generate the insurance policies for the people who are paying for them. You could copy and paste or export the document but the best option is to share the live spreadsheet so they always see updated information. You could share with them the whole spreadsheet as “read-only” but you might have information or sheets you don’t want to share with them.
The best approach is to create an ‘Agency’ sheet in the same spreadsheet, with all the information you want to share with the agency. Then create a new Spreadsheet and in the first row write:
This will create a new Spreadsheet with only the sheet you want to show the agency, so you can now share it. Whenever you update the original Spreadsheet this mirror sheet will conveniently keep up to date.
Send custom payment emails from Spreadsheets
Once again this is a task that I could afford to do manually when we were fewer people but now doesn’t scale. Using the power of the Google Scripts I generate the corpus of the email, containing the options each user selected.
In the actual Spreadsheet I calculate the total price and generate the email corpus in one function call and a single iteration, but it’s easier to explain it separately.
The function ‘mailText’ generates a custom email corpus showing the user the options he chose and showing the total amount to pay. The function takes all options as parameters.
Once the email corpus is generated, a final script runs directly from the script editor iterates through every row in the Spreadsheet and sends an email to each user containing the custom corpus.
And every user gets the email in their inbox.
The powerful combination of Typeform, Google Spreadsheets, and Google Scripts is great, but after organizing ski trips for years I see a clear next step. A modern ski agency app that would let companies and individuals organize their custom ski trips adjusting every detail to their budgets and keeping all the information, communication, and payment processes in one place. Considering there are more than 6M skiers only in Spain we are looking at an interesting market.
How does Skitnig sound for a new startup name?