Search code examples
htmlgoogle-sheetsembedgoogle-sites

Effective Embed Range from Sheets to Sites


There's this code to embed a range from a sheet into Google Sites:

<iframe 
src="https://docs.google.com/spreadsheets/d/e/SHEET_CODE/pubhtml?
gid=SHEET_ID&amp;range=B1:G10&amp;single=true&amp;widget=false&amp;chrome=false&amp;headers=false&amp" width"100%" height="100%" style="border:none;"></iframe>

This code should show only 1 tab, no widget, no header, no sheet name, and it should adapt the range into the site page but it shows only a part of the range:

enter image description here

How can I make the range to show entirely and adapt to the page? Can also someone confirm that this method updates the embed range everytime a change is made into the master sheet?

PS: Also found a method that uses into the sheet link:

gviz/tq?tqx=out:html&tq&

as explained here, which effectively displays all the range and even loads pretty fast but it doesn't import any cell editing from the master sheet.


Solution

  • The issue was fixed by adding an = on the width attribute to fulfill the HTML syntax. The final code should look like this:

    <iframe
      src="https://docs.google.com/spreadsheets/d/e/SHEET_CODE/pubhtml?
              gid=SHEET_ID&amp;range=B1:G10&amp;single=true&amp;widget=false&amp;chrome=false&amp;headers=false&amp"
      width="100%"
      height="100%"
      style="border: none;"
    ></iframe>