Recently I got to know about the policies enforced by my employer about the IP, techincally I do not own the IP of this project although I'd still be the author of this project. I got some good insights on the security side due to employer's involvement into monoSheet.
Please note that this still remains to be an open source project under the MIT license, as to respect the IP ownership I'll update the license agreement in a few days.
- "Me" filter for saved search filter baked into the integration.
- Support for OAuth 1.0a
- Support for OAuth 2.0 [Algos other than RSA] ✅
monoSheet provides a comprehensive solution to integrate NetSuite with Google Sheets using Google Apps Script and NetSuite RESTlet scripts. It enables users to fetch datasets and saved searches from NetSuite and populate them directly into Google Sheets for analysis and reporting. The solution leverages OAuth 2.0 authentication with JWT tokens for secure data transfer and includes caching mechanisms for optimized performance. A user-friendly HTML interface is provided for easy configuration of NetSuite credentials and report mappings.
- Previous Version Demo
- Prerequisites
- Repository Structure
- Setup and Configuration
- Key Components
- OAuth Scopes
- Error Handling
- Google Secret Manager Configuration
- Third-Party Libraries
- Key Changes
-
NetSuite Setup:
- Ensure NetSuite RESTlet scripts are deployed and accessible.
- Obtain the following credentials:
- NetSuite Account ID
- OAuth 2.0 Client ID and Private Key
- Certificate ID (KID)
- Google Secret Manager project ID and secret details
-
Google Cloud Setup:
- Configure Google Secret Manager with NetSuite credentials.
-
Google Sheets Setup:
- Open a Google Sheet and add the provided script & HTML to the Apps Script editor.
.
├── Appscript Files
│ ├── README.md
│ ├── appScriptGSheetDataPull.gs
│ ├── jrassign-all-min 11.1.0.js
│ └── nsUiConfig.html
├── SuiteScript Files
│ ├── README.md
│ ├── RS_getDataset.js
│ └── RS_getDatasetMetadata.js
├── README.md
└── LICENSE
- Appscript Files/: Contains the Google Apps Script code for integration and the HTML configuration interface.
- SuiteScript Files/: Contains the NetSuite RESTlet scripts for metadata retrieval and data fetching.
- README.md: Documentation for setting up and using the integration.
- LICENSE: License information for the repository.
-
Deploy the provided RESTlet scripts in NetSuite:
RS_getDatasetMetadata.js
: Fetches metadata about datasets and saved searches.RS_getDataset.js
: Retrieves data from datasets and saved searches.
-
Obtain the required OAuth credentials from your NetSuite account settings.
- Configure Google Secret Manager to store NetSuite credentials in the specified format.
- Open the Script Editor (
Extensions > Apps Script
) in your Google Sheet. - Copy and paste the contents of
appScriptGSheetDataPull.gs
into the script editor. - Add
nsUiConfig.html
as a new HTML file in the script editor. - Add two parameters - 'menuData' & 'nsConfig' to the script properties.
- Save and close the script editor.
- appScriptGSheetDataPull.gs: Handles authentication, data fetching, caching, and UI generation within Google Sheets.
- Functions:
onOpen()
: Initializes the custom menu in Google Sheets.showConfigurationDialog()
: Opens the configuration UI.getAccessTokenCached()
: Manages OAuth token retrieval and caching.getData()
: Fetches data from NetSuite and publishes it to Google Sheets.
- RS_getDatasetMetadata.js: Retrieves metadata about datasets and saved searches.
- RS_getDataset.js: Fetches actual data from NetSuite based on user-defined parameters.
- nsUiConfig.html: Provides a graphical interface for configuring NetSuite credentials and report mappings.
Ensure the following OAuth scopes are enabled for the script to function correctly:
"oauthScopes": [
"https://www.googleapis.com/auth/script.external_request",
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/spreadsheets.currentonly",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/script.container.ui"
]
- Comprehensive
try-catch
blocks are implemented to handle potential errors. - Errors from NetSuite API and Google Secret Manager are logged using
Logger.log
and displayed viaui.alert
.
Ensure your Google Secret Manager stores the NetSuite configuration in the following JSON format:
{
"pagestoload": "5", // Minimum-0, Maximum-anything that restlet can handle within governance, but do note higher number = higher API response time
"metadatascriptid": "NSMETADATASCRIPTID",
"metadatadeployid": "NSMETADATASCRIPTDEPLOYID",
"reportscriptid": "NSREPORTSCRIPTID",
"reportdeployid": "NSREPORTSCRIPTDEPLOYID",
"kid": "OAUTH2_CERTIFICATE_ID",
"clientid": "CLIENT_ID",
"privatekey": "PRIVATE_CERTIFICATE"
}
- jsrsasign: Maintained by Kenji Urushima
- [21/01/2025]
- Added folders to maintain files hierarchy.
- Added a "Third-Party Libraries" section to acknowledge the use of the MIT-licensed library.
- Maintained the structure and clarity of
README.md
.
- [01/02/2025]
- Added support for Saved Searches.
- Added support for Report grouping - allows users to group multiple reports so that they can be loaded in a single click.
- Added UI config page to setup your integration and report mappings.
- Added technical docs to each folders.
- [02/02/2025]
- Added the missing script properties for the appscript.
- [04/02/2025]
- Added the previous version demo.