Skip to content

Instantly share code, notes, and snippets.

@ankitpandey2708
ankitpandey2708 / file.txt
Created April 19, 2025 07:19
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: