1

this is the function I am using

function getIPforApp() {
  var url = "http://api.ipify.org";
  var rtn = UrlFetchApp.fetch(url);
  Logger.log('this is rtn : '+ rtn);
  return (rtn);  

'

if I run this from the script editor IP in log is : my ip which is perfect XX.xxx.44.166

however when I run it from a sheet

IP in log is : 107.178.195.39 or IP in Log is : 35.243.23.187

If this is the wrong approach can anyone point me it the right direction PLEASE

wilstyx
  • 11
  • 3
  • What exactly is the question? Yes,that's how requests are made and it changes depending on how you call it. It's unclear what you're asking though. – TheMaster Sep 17 '22 at 18:53
  • Related/Possible duplicate: https://stackoverflow.com/questions/63024346/ (**see comments**) – TheMaster Sep 17 '22 at 19:00
  • @TheMaster said "it changes depending on how you call it" so how Should I call it from the sheet . Currently using onEdit ? – wilstyx Sep 17 '22 at 19:56
  • I ask again, What's the question? What's the problem? Whatever works, you can call it like that. – TheMaster Sep 17 '22 at 19:58
  • Thank you for answering so quickly ! if I MANUALLY start this script using the RUN in the google script editor by selecting it from the list it works as expected I get my device IP BUT when it is called from my google sheets cell using the on edit trigger i get a different answer. maybe it's the nature of the beast but thinking its now giving me the IP of the sheet ? but the apps script editor is calling this directly from my local ? – wilstyx Sep 17 '22 at 20:40

0 Answers0