Skip to content

Instantly share code, notes, and snippets.

View rubenrivera's full-sized avatar

Rubén Rivera rubenrivera

View GitHub Profile
@rubenrivera
rubenrivera / Code.gs
Last active October 17, 2021 19:15
Simple Excel / Google Sheets like HTML table (no column/row headers)
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('index')
}
@rubenrivera
rubenrivera / Code.gs
Created August 23, 2018 17:08
Google Apps Script bounded to spreadsheet project that logs the timestamp and user email next to the edited cell for an specified range. It assumens that the spreadsheet has only one sheet.
/**
* Log the timestamp and user email next to the edited cell
* @param {Event} e Edit event object
*
*/
function logWhenWho(e){
// Get timestamp ASAP for the best precision
var timestamp = new Date();
@rubenrivera
rubenrivera / noTraslateAddonName.js
Last active August 20, 2018 16:37
Functión autoejecutable para evitar la traducción del nombre de un complemento en el título de un post de Blogger. Inclúyase al inicio del post en la vista HTML y modifique los valores de addonName y newAddonName
<script>
(function(){
var addonName = 'Visor de Registros';
var newAddonName = 'Visor&nbsp;de&nbsp;Registros';
var dTitle = document.querySelector('title');
dTitle.classList.add('notranslate');
dTitle.setAttribute('translate','no');
var eTitle = document.querySelector('.post-title,.entry-title');
var title = eTitle.innerHTML.replace(addonName,'<span class="notranslate" translate="no">newAddonName</span>');
eTitle.innerHTML = title;
@rubenrivera
rubenrivera / Logger-AddonUtilities.gs
Last active August 1, 2018 15:54 — forked from mogsdad/Logger-AddonUtilities.gs
Google Apps Script utility functions for persistent logging. See https://mogsdad.wordpress.com/?p=193.
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* AddonUtilities.gs
*
* A collection of general Google-Apps-Script utilities that are useful for
* development of Add-ons.
*
* From: gist.github.com/rubenrivera/89c16e85c2bb8556f95788d630dc4b7f
* Based on: gist.github.com/mogsdad/39db2995989110537868
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@rubenrivera
rubenrivera / GoTo.gs
Created May 2, 2018 02:58
Go To Macro. Shows a prompt on which the user set the address of cell to quickly jump into.
// Related Q&A https://webapps.stackexchange.com/q/116736/88163
function GoTo() {
var spreadsheet = SpreadsheetApp.getActive();
var Ui = SpreadsheetApp.getUi();
var buttons = Ui.ButtonSet.OK_CANCEL;
var response = Ui.prompt('Go to', 'Where do you want to go?', buttons);
if(response.getSelectedButton() === Ui.Button.OK){
var address = response.getResponseText();
spreadsheet.getRange(address).activateAsCurrentCell();
}
@rubenrivera
rubenrivera / question.md
Last active September 2, 2024 23:26
Question - Answer from Web Applications [Show URL used to edit responses from a Google Form in a Google Spreadsheet by using a script](http://webapps.stackexchange.com/q/89551/88163)

Revision 3 http://webapps.stackexchange.com/revisions/89551/3

Show URL used to edit responses from a Google Form in a Google Spreadsheet by using a script

I'm trying to make the edit URL for a Google Form automatically populate in the response Google Sheet that it's attached to. I've seen this already and want to use it, but I'm having issues trying to figure out where exactly to put the script.

I've tried putting it in the script editor in the Google Spreadsheet that I would like the URL to appear in, but I'm not sure where to go from there. In the script editor I've tried to test it as an add-on but that didn't end up working.

I have little experience with scripts and the script editor in Google Sheets. As a final note I am using one other add-on called AutoCrat in the same Google Spreadsheet.

@rubenrivera
rubenrivera / enviarEmail.gs
Created January 28, 2017 18:13
Código incluido en respuesta publicada en Stack Overflow en Español. Véase http://es.stackoverflow.com/a/46538/65.
function enviarEmail() {
//Iniciamos
//Validar si hay cuota disponible. En caso contrario avisar al usuario y terminar.
var cuotaDisponible = MailApp.getRemainingDailyQuota();
Logger.log('Cuota disponible previa: %s', cuotaDisponible);
if(cuotaDisponible < 1) {
Browser.msgBox('No queda cuota disponible por hoy. Intenta más tarde.');
return;
}
// Obtener la celda actual