Skip to content

Instantly share code, notes, and snippets.

Last active January 19, 2023 08:29
Show Gist options
  • Save tanaikech/a290509e3d3f6997d248b88763fc69b9 to your computer and use it in GitHub Desktop.
Save tanaikech/a290509e3d3f6997d248b88763fc69b9 to your computer and use it in GitHub Desktop.
Pseudo Browser with Google Spreadsheet

Pseudo Browser with Google Spreadsheet


This is a sample script for creating the pseudo browser using Google Spreadsheet.


I unexpectedly noticed this. I think that this is for off-line browsing using HTML data. So there are many limitations. At first, please confirm them.

  • Limitations
    • It cannot move from opened site to other outside site. If the outer site is opened as a new wind, your own browser is opened and move there.
    • For URL, it can move directories which is one low. But it cannot move directories more than two deeper.
      • Because it retrieves the HTML data from the inputted URL using UrlFetchApp. It cannot move to the out side of data retrieved by UrlFetchApp.
    • The access to the site opened by inputting URL is run at Google side.
    • Javascript on the opened site is run at your local PC side.
    • User-Agent cannot be changed from Mozilla/5.0 (compatible; Google-Apps-Script).

What I thought the interesting is that the appearance of the site has been maintained at this pseudo browser. And, by using this, the sites which are slow speed at your environment might be able to be opened smoothly.



Please copy and paste following respective HTML and GAS to your script editor. Please launch the script editor on container-bound script for spreadsheet.


Filename is index.html.

<!DOCTYPE html>
      input.in1 {
        width: 90%;
      <input type="text" name="url" class="in1">
      <input type="button" value="Run" class="in2"

2. GAS

Filename is

function inputurl() {
  var html = HtmlService.createHtmlOutputFromFile('index')
  SpreadsheetApp.getUi().showModalDialog(html, 'URL?');

function launchbrowser(p) {
  var html = UrlFetchApp.fetch(p.url);
  var blob = HtmlService.createHtmlOutput(html)
    .setTitle("Sample Browser");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment