It's called Google Apps Script https://developers.google.com/apps-script/