Skip to content

Instantly share code, notes, and snippets.

@ankitpandey2708
Created April 19, 2025 07:19
Show Gist options
  • Select an option

  • Save ankitpandey2708/1c14e8e923fd02d7f2f721e309f5cd69 to your computer and use it in GitHub Desktop.

Select an option

Save ankitpandey2708/1c14e8e923fd02d7f2f721e309f5cd69 to your computer and use it in GitHub Desktop.

Revisions

  1. ankitpandey2708 created this gist Apr 19, 2025.
    13 changes: 13 additions & 0 deletions file.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    javascript:(function(){var m=location.href.match(/https:\/\/docs\.google\.com\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);if(!m){alert('Not a valid Google Sheets link!');return;}var u='https://docs.google.com/spreadsheets/d/'+m[1]+'/htmlview',w=window.open(u,'_blank'),f=function(){var s=document.createElement('style');s.innerHTML='.docsshared-no-select{-khtml-user-select:text!important;-moz-user-select:text!important;-ms-user-select:text!important;-webkit-user-select:text!important;user-select:text!important;}#sheets-viewport,#sheets-viewport.widget-viewport{overflow:unset!important;}';document.head.appendChild(s);},t=setInterval(function(){try{if(w.document&&w.document.readyState==='complete'&&w.document.querySelector('#sheets-viewport')){clearInterval(t);w.eval('('+f.toString()+')()');}}catch(e){}},500);})();


    How to use:
    1. Copy the code above
    2. Create a new bookmark in your browser.
    3. Paste the code as the bookmark's URL.
    4. While viewing a Google Sheets link, click the bookmarklet.

    What it does:
    1. Opens the /htmlview version in a new tab.
    2. Waits for the sheet to load.
    3. Injects your CSS to make the sheet selectable and fix overflow.