use google spreadsheet as a proxy

Notice: This article can be outmoded due to the availability of new Google services. It should be saved for the uniqueness of its main idea.

Applications of Google spreadsheet functions for external data are virtually endless, and my previous article on how =IMPORTXML() can help to automate the process of collecting web data is just an example. Since fantasy has no limits, I want to show that another possibility is to build… a proxy. Yes, a proxy inside Google preadsheet. Let see.

According to Google help function =IMPORTDATA() retrieves information from a CSV or TSV file, but really it can be used for whatever web page. So, if I am precluded to visit a certain web site, say, in theory in an opened spreadsheet I could get the source code of its web page by =IMPORTDATA(""), copy and paste the returned string in a notepad window, save it as a html file and finally open it with the browser. If I need another page, I have to repeat all these steps, but clearly this is a bit clumsy.

I made no other reasoning until the reading about text mirror on convinced me that automating the described sketch would have made possible to get a better tool.

So I have build a small proxy app. It works combining two ad hoc elements: a spreadsheet which stores user commands and retrieves the html source of requested pages, and a bookmarklet which creates a minimal browsing interface layer in front of the sheet window and intercepts and processes changes in underlying sheet cells. To begin, the user has to open the spreadsheet and run the bookmarklet. Then, for each input of him (an url request, a move back or forward in the navigation history, a click on any link in the current served page) a form is submitted to the sheet in a transparent way, forcing the html source code of the requested page to be first retrieved on the sheet and then shown on the proxy interface layer. Every time the spreadsheet is opened or refreshed, history of previous session is deleted by a tiny Google apps script. Here is a short demo video.

Surely this proxy has some hard limitations. The main one is that it is text-only. All the elements linked in the page (images, external style sheets and external scripts) aren’t retrieved. Moreover, in order to avoid or at least minimize unexpected conflicts with the Google docs host page, the bookmarklet removes all the inline styles, scripts and even button actions before displaying the page text, so javascript and form interactions lack at all. Therefore don’t believe to log in into facebook or twitter. But unlike text tunnel, the html tags still make possible a rich text reading with headings, lists, tables, bold, italic and underline formatting and most of all an effective navigation thanks to the fully working links.
Indeed, the main worth of this proxy is that it is practically invisible, apart from Google who obviously logs all the activity in the sheet. Among other well known proxies, some, as the one that everybody can set up following this Digital Inspiron tutorial, is subject to url filtering while most of them, as text tunnel, rely on web sites which can be blocked at any time. On the contrary this proxy app works over https protocol, so exhibiting only the private and protected url of the sheet on domain both on the browser history and on a potential firewall device. Even domain can be blocked, too, but it is widely accessed across all the world for fair uses and there is no way (or, at least, no simple way) for an outsider to understand what people are doing inside their own documents.

I must give a disclaimer. I consider this app just a proof of concept. It was nice for me to test it for some occasional browsing and use it in some emergency situations but even if I think it is harmless I cannot recommend it to other people because I do not know Google TOS in detail. Anyhow, remember that Google docs has a blocking system which prevents misuse of external data functions.

For testing purposes, spreadsheet and bookmarklet links are just below. I have checked functioning on Firefox 9 and Iron (Chrome) 14 with no problem on most of the sites I have visited but since the bookmarklet doesn’t work in an isolated iframe and its html parser is not very sophisticated, some unexpected accident could occour on some non-standard pages. If it hangs up when loading a page, refreshing the page and reloading the bookmarklet suffice to start a new session.

Credits: I have used Yaffle’s code to convert relative urls to absolute ones. I thank users on it.comp.language.javascript and in particular ZER0 for his suggestions. If some parts of the bookmarklet are bad written, it’s only my fault.

Proxy6109 (spreadsheet): to copy in your Google docs page
P.S.: IF YOU DON’T MAKE A COPY OF THE SPREADSHEET, IT CANNOT WORK PROPERLY when several persons open it at a time. Since I’m experiencing a massive access to my Google spreadsheet, from now on I am forced to disable form submission to prevent multiple editing. After opening the spreadsheet, go to File > Make a copy and then check Form > Accepting responses to start using it.

Proxy6109 (bookmarklet): to drag on your browser bookmark toolbar.

15 thoughts on “use google spreadsheet as a proxy

  1. Pingback: Using Google documents as a web proxy » Geko Geek

  2. Pingback: Using Google documents as a web proxy | ro-Stire

  3. Pingback: Using Google documents as a web proxy « Hackaday « Cool Internet Projects

  4. Pingback: Using Google documents as a web proxy | TechnoFiesta

  5. Pingback: Using Google documents as a web proxy « « SNAP-DIYSNAP-DIY

  6. Pingback: Nerd News » Blog Archive » Использование Google documents в качестве веб-прокси

  7. Pingback: sei-uno-zero-nove » Blog » metamorfosi di un foglio elettronico cloud

  8. The latest Beta version of Chrome (17.0.963.26) doesn’t work for me but Firefox 8 (it’s my backup browser! [used to be opera…]) does

    that’s weird probably some weird bug I won’t be able to replicate…

    -Vista 64 bit

  9. Unable to copy. When I load the spreadsheet, the File > Make a copy… option is grayed out. There is a Download as… option available.

  10. Problem solved. When I clicked the spreadsheet link it opened a new tab — that wasn’t logged in! When I clicked the login link it recognized that I was logged in elsewhere in the browser, it logged me in, and now the File > Make a copy… link is active.

    Thank you for this interesting development.

  11. @David: Thank you for your feedback.

    @Henry: I’m afraid of not having the magic formula for any browser and any version.
    Anyhow, you can make a short debug. The bookmarklet does two main critical tasks: url submission and sheet change intercept. It is foundamental to realize which one is not carried out.
    First, try to submit an url via proxy gui. Then, wait for some seconds, close the proxy gui and select history sheet: do you see your submitted form? If no, then do Form > Go to live form, select proxy sheet, run again the bookmarlet to make the gui reappearing, return to the form tab and submit the same url indicating 0 as direction, and eventually return to proxy sheet: do you see your requested page?

  12. Pingback: Use Google Docs As A Simple Rich Text Web Proxy | CisforComputers

  13. Pingback: GaaP: Google as a Proxy | devquotes,

  14. Pingback: GaaP: Google as a Proxy | devquotes,

  15. Pingback: iOs

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.