Skip to content

Instantly share code, notes, and snippets.

View goelp's full-sized avatar

Piyush Goel goelp

View GitHub Profile
@goelp
goelp / pick_range.js
Created March 27, 2018 13:13
Google Apps Script functions to pick a range and populate in text field in sidebar
// Add the options to the custom menu
function onOpen() {
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.createMenu('Custom Menu')
.addItem('Show Settings', 'showSidebar')
.addToUi();
}
// initiates the sidebar
function showSidebar() {
@goelp
goelp / quickbooks_js_timezone.js
Last active April 11, 2018 04:54
Timezone conversion in Javascript for Quickbooks API
/** Add hours to a given date object **/
Date.prototype.addHours = function(h) {
this.setTime(this.getTime() + (h*60*60*1000));
return this;
}
/** overall function to create QBO invoices **/
function generateInvoices(){
...
var invoiceDate = new Date();
@goelp
goelp / pick_range_sidebar.html
Last active May 1, 2020 03:39
Sidebar HTML code to show fields and buttons to select the range
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
</head>
<body>
<div class="sidebar branding-below">
<div class="block form-group">
<label for="names-range"><b>Comissions</b></label>
@goelp
goelp / gas_qbo_oauth2.js
Last active January 28, 2024 11:36
Google Apps Script OAuth2 script for QuickBooks integration with Google Sheets
var CLIENT_ID = '...'; // Get from Quickbooks Developer Console
var CLIENT_SECRET = '...'; // Get from Quickbooks Developer Console
var BASE_AUTH_URL = 'https://appcenter.intuit.com/connect/oauth2';
var TOKEN_URL = 'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer';
var API_SCOPE = 'com.intuit.quickbooks.accounting';
var REDIRECT_URI = '...'; // Generate using the logRedirectUri() function mentioned at the end of this script
var RESPONSE_TYPE = 'code';
/**
* Authorizes and makes a request to the Quickbooks API using OAuth 2.