Skip to content

Instantly share code, notes, and snippets.

View juangesino's full-sized avatar

Juan Gesino juangesino

View GitHub Profile
@juangesino
juangesino / convert2Spreadsheet.js
Last active July 28, 2019 08:30 — forked from soundTricker/convert2Spreadsheet.js
Convert Excel file to Sheets on Google Apps Script.
var KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; //developer key , get on https://code.google.com/apis/console/ and set enable the Drive API.
/**
* Convert from Excel data to Spreadsheet
* @param {Blob} excelFile the excel blob data.
* @param {String} filename file name on uploading drive
* @return {Spreadsheet} spreadsheet instance.
**/
function convert2Spreadsheet(excelFile, filename) {
var oauthConfig = UrlFetchApp.addOAuthService('drive');
@juangesino
juangesino / percent-filter.js
Last active September 1, 2015 01:35 — forked from jeffjohnson9046/percent-filter.js
Format percentages in AngularJS
// In app.js or main.js or whatever:
// var myApp = angular.module('askchisne', ['ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']);
// This filter makes the assumption that the input will be in decimal form (i.e. 17% is 0.17).
myApp.filter('percentage', ['$filter', function ($filter) {
return function (input, decimals) {
percentage = $filter('number')(input * 100, decimals);
percentage = percentage.toString().replace(/(\.[0-9]*?)0+$/, "$1").replace(/\.$/, "");
return percentage + '%';
};