GitHubGraphQLRequest Library for Google Apps Script Project ( Sheets Container-bound script )
Sheets Container-bound script Project.
This library is for Spreadsheet Container-bound Script as it adds menus to Spreadsheet.
Choose one of them please.
- add Project ID for your project as Library
14hP6p8PPzAy_yclpF-kXDSIpylKEDx-iJvMJtd1DSJJzJVV8miYzv_fS
- Copy and Paste this code
I would recommend #2 for speed of execution, but #1 is also a good option for administrative costs.
open Script Editor
function onOpen () {
GitHubGraphQLRequest.registerGhgraph()
}
Set your GitHub Access Token into UserProperty with menu [ GitHub Token ]
example
/**
* @returns {object}
* @customfunction
*/
function request () {
try {
const body = JSON.parse(
GitHubGraphQLRequest.request(query)
.getContentText()
)
return transform(body...nodes)
} catch (e) {
console.error(e)
return [['Something', 'wrong']]
}
}
transform()
is a function that transforms a nested JavaScript Object into an Array of Arrays ( e.g. [ [], [], ...] ) for Spreadsheet.
=request()