{"id":22886454,"url":"https://github.com/willdev12/gs-httpget","last_synced_at":"2025-09-25T12:41:53.325Z","repository":{"id":185732459,"uuid":"673991626","full_name":"WillDev12/gs-httpget","owner":"WillDev12","description":"A very simple method for running code from an external url in Google Script","archived":false,"fork":false,"pushed_at":"2023-08-02T23:22:34.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-06T23:18:38.392Z","etag":null,"topics":["google","google-cloud","google-script","gs","http","httpget","library","urlfetchapp"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WillDev12.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-02T22:33:23.000Z","updated_at":"2023-08-02T23:25:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"58410c46-1239-49d4-9836-454eb9e8ff08","html_url":"https://github.com/WillDev12/gs-httpget","commit_stats":null,"previous_names":["willdev12/gs-httpget"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillDev12%2Fgs-httpget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillDev12%2Fgs-httpget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillDev12%2Fgs-httpget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillDev12%2Fgs-httpget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WillDev12","download_url":"https://codeload.github.com/WillDev12/gs-httpget/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246522955,"owners_count":20791420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google","google-cloud","google-script","gs","http","httpget","library","urlfetchapp"],"created_at":"2024-12-13T20:18:50.520Z","updated_at":"2025-09-25T12:41:48.276Z","avatar_url":"https://github.com/WillDev12.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# httpget for GS\n\nHttpget is a useful function that allows you to evaluate code from a url.  Using Google's UrlFetchApp api, you can create a similar function for Google user scripts.\n\n# Documentation\n\n\u003e **Warning:** To perform an httpget, you must use an `eval` statement to run ALL code from the remote url.  Because of this, it can be very easy to accidentally run malicious code if used recklessly.  **Please be careful when using this method.**\n\nAs stated before, httpget simply fetches and evaluates any code placed in a remote url.  This can be used for many reasons, such as minimizing installation steps *(a quick copy and paste sure does the trick doesn't it?)*, fetching others' code without having to add a library (use the raw link), or in some cases shrinking file size.\n\nPerforming an httpget is simple.  Using Google's [Url Fetch Service](https://developers.google.com/apps-script/reference/url-fetch), grabbing the code comes down to a one liner:\n\n``` javascript\nlet data = UrlFetchApp.fetch(\"https://example.com/file.gs\").getContentText();\n```\n**Next**, evaluate the code that the variable `data` returns:\n\n``` javascript\neval(data);\n```\n\u003csup\u003eLike I said before, please be careful when using this statement as it is [INCREDIBLY](https://stackoverflow.com/a/13167699/20472970) easy to accidentally run malicious code.  Since there is no other way to run code like this in gs, `eval` is the only alternative.\u003c/sup\u003e\n\n### Full function\n``` javascript\n// Normal (100 bytes)\nfunction httpget(url) {\n    let data = UrlFetchApp.fetch(url).getContentText();\n    eval(data);\n}\n\n// when using in function form, replace the\n// actual url with an assignable variable.\n\n// Compressed (59 bytes)\nfunction l(s){eval(UrlFetchApp.fetch(s).getContentText());}\n```\n\n### Library (If interested)\n\n```\n1U5RzdkF4G3QdK9HKJ3B6ScNewj7KThz17yjAyXT3AM-neyNTJQ9qa7Qf\n```\n\n# Like content like this?\n\nFollow my [Github](https://github.com/WillDev12) or share (this means a lot to me)\n\n```\nhttps://github.com/WillDev12\nhttps://WillDev12.github.io\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilldev12%2Fgs-httpget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilldev12%2Fgs-httpget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilldev12%2Fgs-httpget/lists"}