it’s a helper extension allows you to use Google Apps Script and supporting google apps from client side. You can simply use javascript code to send emails, CRUD data on your google spreadsheet, Upload files to your google drive, Set/remove reminders on your google calander, Find Address details from of a Lat-n-Lng, Get polyline and many more. In short you can manage all your google apps supported by google app script using this extension.
It is not bounded to use with google apps only, you can even use normal javascript codes to run on server and then return the response.
Extension
- Version : 1.0
- Click here to Download
Note : You can also use Web-Component of MitAppinventor and its distributions.
Server Codes
In order to use this extension you’ll have to deploy server codes, that you’ll find on my GitHub. And deploy it to create webhook/server-url. Go to scripts.google.com and create a new project. Now paste the below codes there.
var accessKey = "ilikeyourwork@cttricks";
var def_response = {"code":401,"msg":"invalid request, kindly check your access key and try again"}
function doGet(e){
if(e.parameter.accessKey == accessKey){
return runCodes(e);
}
return ContentService.createTextOutput(JSON.stringify(def_response));
}
function doPost(e){
if(e.parameter.accessKey == accessKey){
return runCodes(e);
}
return ContentService.createTextOutput(JSON.stringify(def_response));
}
function runCodes(e){
var response = {"code":401,"msg":"data/code is not given","data":""};
var client_data = e.parameter.data;
if(client_data !== undefined && client_data !==""){
try{
var output = eval(client_data);
response["code"] = 200;
response["msg"] = "code executed successfully";
response["data"] = output;
}catch(e){
response["code"] = 401;
response["msg"] = e.toString();
response["data"] = "";
}
}
return ContentService.createTextOutput(JSON.stringify(response));
}
Please note that, You are free to change the accessKey, It is there to provide an additional security so that no one elase can use your V8 Engine.
Modify appsscript.json file
To add oauthScopes in appsscript.json file, in order to authenticate and use google apps from client side using thus V8 Engine Extension. If you can’t see this appsscript.json file with codes.gs file in left panel then you have to make it visible by clicking on View>Show manifest file at the top navigation bar.
Once you have the manifest/appsscript.json file add oauthScopes in there… Currently i am adding Spreadsheet and Email but you can add more according to your need.
{
"timeZone": "Asia/Kolkata",
"dependencies": {
},
"webapp": {
"access": "ANYONE_ANONYMOUS",
"executeAs": "USER_DEPLOYING"
},
"exceptionLogging": "STACKDRIVER",
"oauthScopes": ["https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/script.send_mail"],
"runtimeVersion": "V8"
}
Now simply deploy this and create webhook for the extension.
Sample JS codes
Here are some sample codes that you can run using V8 Engine AIX.
- Convert Language
LanguageApp.translate('How are you?', '' , 'hi');
- Send email from your own gmail account
- MailApp.sendEmail(‘[email protected]’, ‘test 01’, ‘test of v8 engine extension’)
- Get location address.
- Maps.newGeocoder().reverseGeocode( ‘9.748816’, ‘118.739162’)
- Get value from Spreadsheet
- SpreadsheetApp.openByUrl( “Spreadsheet_URL” ).getSheetByName( “Sheet1” ).getRange( “A1:Z1” ).getValues();
- Store Value on Spreadsheet
- SpreadsheetApp.openByUrl( “Spreadsheet_URL” ).getSheetByName( “Sheet1” ).appendRow([“I”,”am”,”Ct tricks”]);
For reference to use google apps, you can explore apps script docs, Also if you have any query or suggestion feel free to ask me.
Enjoy!!
You may also like…
- Words Search Game – Free Niotron & xThunkable Project File
- Integrate PayPal Payment Gateway In Your App Without Using Any Extension Or Server File – PayPal Payment Links API
- Nio Quiz App