- Create a new Google Sheets file
- Go to Extensions → Apps Script
- Remove all the code and copy-paste the following instead
- Save your project and go back to your sheet
- Use =useClickUp({email}) like classic Google Sheets Formula
The new function in Google Sheets:
The code to paste in Apps Script inside Google Sheets:
/**
* Know if someone uses Notion
*
* @param {string} email.
* @return true or false
* @customfunction
*/
function useNotion(email) {
url = "https://www.notion.so/api/v3/getLoginOptions";
Logger.log(url)
var options = {
"muteHttpExceptions": true,
"method": "post",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
},
"payload": JSON.stringify({
"email":email
})
};
var response = UrlFetchApp.fetch(url, options);
Logger.log(response)
var responseCode = response.getResponseCode();
var responseBody = response.getContentText();
if (responseCode === 200) {
Logger.log(response)
if(JSON.parse(response).hasAccount == true){
return "✅"
} else {return "❌"}
} else {
Logger.log(Utilities.formatString("Request failed for %s, got %d: %s", responseCode, responseBody));
return "Error";
}}
/**
* Know if someone uses ClickUp
*
* @param {string} email.
* @return true or false
* @customfunction
*/
function useClickUp(email) {
url = "https://app.clickup.com/verification/v1/email?email="+email;
Logger.log(url)
var options = {
"muteHttpExceptions": true,
"method": "get",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
}
};
var response = UrlFetchApp.fetch(url, options);
Logger.log(response)
var responseCode = response.getResponseCode();
var responseBody = response.getContentText();
if (responseCode === 200) {
Logger.log(response)
Logger.log(response)
if(JSON.parse(response).email_taken == true){
return "✅"
} else {return "❌"}
} else {
Logger.log(Utilities.formatString("Request failed for %s, got %d: %s", responseCode, responseBody));
return "Error";
}}
/**
* Know if someone uses Monday.com
*
* @param {string} email.
* @return true or false
* @customfunction
*/
function useMonday(email) {
url = "https://auth.monday.com/auth/login/email_first_login?email="+email;
Logger.log(url)
var options = {
"muteHttpExceptions": true,
"method": "get",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
}
};
var response = UrlFetchApp.fetch(url, options);
Logger.log(response)
var responseCode = response.getResponseCode();
var responseBody = response.getContentText();
if (responseCode === 200) {
Logger.log(response)
if (JSON.parse(response).accounts_count > 0){
return "✅"
} else {return "❌"}
} else {
Logger.log(Utilities.formatString("Request failed for %s, got %d: %s", responseCode, responseBody));
return false;
}}