2

I found javascript solution for removing gridlines on Google docs spreadsheets (using "download as HTML" and then past javascript in Web Address Bar): works great !!

javascript:var v="none",e="defaultView",o="border",m="Color",w=function(a,b){if(document[e]){if(document[e].getComputedStyle(a,null)[o+b+m]=="rgb(204, 204, 204)")a.style[o+b]=v}else if(a.currentStyle[o+b+m]=="#ccc")a.style[o+b]="none"},q=function(a){a=window.document.getElementsByTagName(a);for(var b=0;b<a.length;b++){var c=a[b];w(c,"Left");w(c,"Right");w(c,"Bottom");w(c,"Top")}};q("td");q("table");

Was wondering if it is possible to make a comparable javascript to remove the header and footer for docs "publised" to the web?! Published spreadsheets have a -> header: filename + sheetname; -> footer: "Edit this page (if you have permission) – Published by Google Docs – Report Abuse – Updated automatically every 5 minutes" -> example: TEST (I already added "&gridlines=false" to the url to remove gridlines).

Why is previous solution not sufficient ?! I want some people to view and print the result of a spreadsheet (via publish to web) without giving them access (view) to the spreadsheet itself. Therefore they can't use "download as HTML" + your javascript, but want to provide a url to view a published site and be able to make a neat print without the Google header and footer.

Would be great if anyone could help out!

Regards,

Zjost
  • 31
  • 1
  • 1
  • 3
  • 3
    I'm voting to close this question as off-topic because the linked example is no longer available, making the question unclear for future users. – Mogsdad Jan 17 '18 at 03:13

3 Answers3

2

Thankfully the layout on this page is super simple.

<div id="header">...</div>
<div id="content">...</div>
<div id="footer">...</div>

You could write a function like this to hide the header and footer.

var f = function(id)
{
    document.getElementById(id).style.display = "none";
};
f("header");
f("footer");

Or the copy paste version:

javascript:var f=function(id){document.getElementById(id).style.display="none";};f("header");f("footer");
Joel
  • 19,175
  • 2
  • 63
  • 83
2

I built an app that does just this + improves the default layout. Check it out: http://gdoc.pub

Augustin Riedinger
  • 20,909
  • 29
  • 133
  • 206
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/18537803) – Shadow Jan 17 '18 at 03:36
  • Well, this is a web app so if the link dies, the solution dies along. Better update the post if so I reckon. Otherwise I could bring all the app's marketing here but I don't think this would be very SO-friendly either... – Augustin Riedinger Jan 22 '18 at 13:42
0

You can use the range parameter to get rid of the headers and footers, as described here.

Community
  • 1
  • 1
stenci
  • 8,290
  • 14
  • 64
  • 104