This is the gatsby-styled-blog-starter demo site. To download the code and get some instructions visit the Github repository . To be informed about updates follow @greglobinski

Autocompleting Documentation

Documenting your code makes it easier to understand

September 16, 2017

How can you create those cool autocompleting popups on your custom functions?

In this video I am explaining how to build them for yourself.

If you are going to be writing custom functions in a sheet that other users will be collaborating on, it is going to be important that you document the functions that you are writing. How else can you expect those users to know what they are doing?

In a future video I’ll be talking about how you can share your custom functions in different projects. Because when you think about it, the entire point of programming is to prevent having to do things more than once!

 * Get the current exchange rates of chosen currencies
 * @param {11} amount The amount of currency to exchange
 * @param {["CNY"} from [OPTIONAL] The currency type to be converted
 * @param {"USD"]} into [OPTIONAL] The currency type to exchange into
 * @return The exchanged amount
 * @customfunction
function CURRENCYEXCHANGE(amount, from, into) {
  from = from || 'CNY';
  into = into || 'USD';

  if(from.length !== 3 || into.length !== 3) {
    throw TypeError('Currency type must be a 3 letter code.');

  var url = '' + into.toUpperCase() + '&symbols=' + from.toUpperCase();

  var response = UrlFetchApp.fetch(url);
  response = JSON.parse(response);

  var exchange = amount / response['rates'][from];

  return parseFloat(exchange.toFixed(2));

Please send me comments on twitter or in the discussion below!


jordan rhea I started as a teacher and taught myself to code with Python and JavaScript. Now I am passionate about sharing code and strategies to make teachers (and other G Suite users) as effective as possible with technology.

© jordan rhea 2018