Embedding google sheet cells that can be sorted by

2019-06-26 04:06发布

问题:

I'd like embed a google sheet to my HTML website that would show only cells with data (no header, row numbering, letter-named columns, border etc.) and it could be filtered by the viewers. Viewers could temporarily filter the data but it shouldn't change the original filtering.

I have google sheet that has multiple columns with title and data below. I've filtered data (including title) using google sheets 'filter' option. I'm aware that there's a way to embed sortable google sheet if I use share link that allows viewing or editing. But when I am using that edit or view link, I cannot use almost any url parameters.

  • Example edit/view link: https://docs.google.com/spreadsheets/d/{spreadsheet-key}/edit?usp=sharing

  • Best try so far is using url parameter &rm=minimal but it still shows other sheets, numbered rows and letter-named columns

I can use url parameters on link that I get from File -> Publish to the web -> Embed. Here's the link:

< iframe frameborder="0" height="440" scrolling="no" src="https://docs.google.com/spreadsheets/d/{spreadsheet-key}/pubhtml?gid=0&amp;single=true&amp;range=A1:N20&amp;widget=false&amp;chrome=false&amp;headers=false" style="float: left;" width="761"></iframe >

=> I get visually just what I want: a clean spreasheet embedded containing only data. But now it can't be filtered.

Here's best iframe so far (sortable but not clean):

< iframe height="440" frameBorder="0" src="https://docs.google.com/spreadsheets/d/{spreadsheet-key}/edit?usp=sharing&rm=minimal" width="761"></iframe >

Is there a way to show only data cells and still allow sorting?

回答1:

The filter/sort functionality gets lost when embedding a google sheet with html; same is true when freezing rows/columns. Google has not solved this yet, although it has been requested for years. It is possible to do this when embedding via Excel Online though, but that one is a bit slow.