This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #GoogleAppsScript #Gscript #GoogleSpreadsheet | |
//Personalised from google help page : https://developers.google.com/apps-script/scriptdb | |
function setup(){ | |
ScriptProperties.setProperty('sheet', SpreadsheetApp.getActiveSpreadsheet().getId()); | |
} | |
function addAll() { | |
var spreadsheet = SpreadsheetApp.openById(ScriptProperties.getProperty('sheet') );//Run setup in first to initialise script var 'sheet'. | |
var columns = spreadsheet.getLastColumn(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #GoogleAppsScript #Gscript #GoogleSpreadsheet | |
//from google help page : https://developers.google.com/apps-script/scriptdb | |
function deleteAll() { | |
var db = ScriptDb.getMyDb(); | |
while (true) { | |
var result = db.query({}); | |
if (result.getSize() == 0) { | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #GoogleAppsScript #Gscript #GoogleSpreadsheet | |
function getPublicFiles(){ | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var docs = DocsList.getFiles(); //Retrieve all the docs. | |
var listfile = ""; | |
var viewer = new Array; | |
var owner = ""; | |
var me = Session.getUser().getEmail(); //Get the email of the script owner. Need it to check if you are the owner of the file. | |
for(var i in docs){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This script will allow you to push form submission in a Hangouts Chat space by using Webhook | |
* | |
* How to setup ? | |
* 1 - Create a Hangouts Chat space | |
* 2 - Add people | |
* 3 - Create Webhook : https://developers.google.com/hangouts/chat/how-tos/webhooks | |
* 4 - Create a form and go to Apps Script editor | |
* 5 - Copy paste code below | |
* 6 - Replace Webhook url int the code for URL_WEBHOOK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function countLabels() { | |
var labels = GmailApp.getUserLabels(); | |
var count = 0; | |
for(var key in labels){ | |
count++; | |
} | |
console.log('You have '+ count +' labels in Gmail.') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I put that here if that can help someone, | |
// if you have the error "dns.setDefaultResultOrder is not a function" in node.js (nodejs) | |
// or dns.setDefaultResultOrder("ipv4first"); | |
// or TypeError: dns.setDefaultResultOrder is not a function | |
// in the Google Cloud IDE or not, you have to update your node js so enter : nvm install stable | |
// Then you need to make it default enter : nvm alias default stable | |
// If that can help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Send a newsletter or any emails to multiple users easily, no need to use bcc | |
* If you are a workspace user with license > Business Standard you already have the multi-send | |
* https://support.google.com/google-workspace-individual/answer/11243118 | |
*/ | |
function sendMyNewsletter() { | |
let emails = 'COMA_SEPARATED_LIST_OF_EMAILS_NO_SPACE' | |
let subject = 'SUBJECT OF THE EMAILS IN YOUR DRAFT'; | |
let draft = GmailApp.getDraftMessages().find(message => { return message.getSubject() == subject }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Context of this Gist in Medium : https://medium.com/@stephane.giron/discuss-with-your-google-docs-with-google-apps-script-and-gemini-1-5-flash-7f80abef8cb2 | |
// This is implemented in our Google Workspace Add-on onleeAssistant : https://assistant.onlee.xyz/ | |
const API_KEY = ''; | |
const QUESTION = ''; | |
const DOC_ID = ''; | |
function discussWithGoogleDocs() { | |
let doc_content = DocumentApp.openById(DOC_ID).getBody().getText(); | |
let body ={ contents:[ |