Last active
September 6, 2025 03:24
-
-
Save zaelani23/170b6635136e0cb229bff3e199b8f7b4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 orgIP(ip) { | |
| var url = "http://ipinfo.io/"+ ip +"?token=12f70b0a35a87f"; | |
| var response = UrlFetchApp.fetch(url); | |
| var json = JSON.parse(response.getContentText()); | |
| return json.org; | |
| } | |
| function cekIP() { | |
| var url = "http://api.ipify.org/?format=json"; | |
| var response = UrlFetchApp.fetch(url); | |
| var json = JSON.parse(response.getContentText()); | |
| return json.ip; | |
| } | |
| function doGet(request) { | |
| var template = HtmlService.createTemplateFromFile('Index') | |
| var pageData = template.evaluate() | |
| .setTitle("Form") | |
| .addMetaTag("viewport","width=device-width, initial-scale=1") | |
| .setSandboxMode(HtmlService.SandboxMode.IFRAME) | |
| .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL) | |
| return pageData; | |
| } | |
| /* @Include JavaScript and CSS Files */ | |
| function include() { | |
| var HTMLString = "<input type='text' class='form-control' id='ip' value='"+ cekIP() +"' readonly>"; | |
| HTMLOutput = HtmlService.createHtmlOutput(HTMLString); | |
| return HTMLOutput.getContent(); | |
| } | |
| /* @Process */ | |
| function processForm(x,y,z) { | |
| var url = "Paste URL DISINI#gid=0"; | |
| var ss = SpreadsheetApp.openByUrl(url); | |
| var ws = ss.getSheetByName("NAMA SHEET"); | |
| var lokasi = Maps.newGeocoder().reverseGeocode(y, z); | |
| alamat= lokasi.results[0].formatted_address; | |
| ws.appendRow([x,cekIP(),orgIP(cekIP()),y,z,alamat]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
function orgIP(ip) {
var url = "http://ipinfo.io/"+ ip +"?token=12f70b0a35a87f";
var response = UrlFetchApp.fetch(url);
var json = JSON.parse(response.getContentText());
return json.org;
}
function cekIP() {
var url = "http://api.ipify.org/?format=json";
var response = UrlFetchApp.fetch(url);
var json = JSON.parse(response.getContentText());
return json.ip;
}
function doGet(request) {
var template = HtmlService.createTemplateFromFile('Index')
var pageData = template.evaluate()
.setTitle("Form")
.addMetaTag("viewport","width=device-width, initial-scale=1")
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
return pageData;
}
/* @include JavaScript and CSS Files */
function include() {
var HTMLString = "";
HTMLOutput = HtmlService.createHtmlOutput(HTMLString);
return HTMLOutput.getContent();
}
/* @process */
function processForm(x,y,z) {
var url = "Paste URL DISINI#gid=0";
var ss = SpreadsheetApp.openByUrl(url);
var ws = ss.getSheetByName("NAMA SHEET");
var lokasi = Maps.newGeocoder().reverseGeocode(y, z);
alamat= lokasi.results[0].formatted_address;
ws.appendRow([x,cekIP(),orgIP(cekIP()),y,z,alamat]);
}