Skip to content

Instantly share code, notes, and snippets.

@ankitpandey2708
Created April 19, 2025 07:19
Show Gist options
  • Save ankitpandey2708/1c14e8e923fd02d7f2f721e309f5cd69 to your computer and use it in GitHub Desktop.
Save ankitpandey2708/1c14e8e923fd02d7f2f721e309f5cd69 to your computer and use it in GitHub Desktop.
allow copying from protected google sheet
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment