Found Image http://plugins.svn.wordpress.org/inline-google-spreadsheet-viewer/assets/icon-128x128.png Inline Google Spreadsheet Viewer | Plugin Review Network Skip to Content

Plugin Review Network

Plugin Review Network

an eye on the best wordpress plugins
Show Sidebar Hide Sidebar
[+] Sidebar [-] Sidebar
Plugin:
Rated:
90%
4.5 Stars (61 votes)

Home

WP.Org

ReadMe

Support
  • Author:
    Meitar Moscovitz
Version: 0.13.2
Requires: WP 4.0
Last Updated:2350 days ago
Downloads:214259
Installations: 8,000+
Tags:
    chart, csv, data, datatables, embed, google, Google Apps Script, Google Docs, infographics, infoviz, live preview, shortcode, spreadsheet, tables, visualization, web apps
Download Plugin Package

Inline Google Spreadsheet Viewer

Released on August 19, 2010.
Download Plugin Package

Version: 0.13.2

Embeds public Google Spreadsheets, Apps Scripts, or CSV files in WordPress posts or pages as HTML tables or interactive charts, and more.

  • Description
  • FAQ
  • Changelog
  • Installation
  • Screenshots


Easily turn data stored in a Google Spreadsheet, CSV file, MySQL database, or the output of a Google Apps Script into a beautiful interactive chart or graph, a sortable and searchable table, or both. Embed live previews of PDF, XLS, DOC, and other file formats supported by the Google Docs Viewer. A built-in cache provides extra speed.

  • Update your blog post or page whenever a Google Spreadsheet or CSV file changes.
  • Create beautiful interactive graphs and charts from your Google Spreadsheet or CSV files with ease.
  • Customize the table's or chart's look and feel using a powerful and flexible query language and a plethora of configuration options.
  • Use data from a variety of different sources: Google Spreadsheets, Google Apps Scripts, CSV files, your WordPress database, or a remote MySQL database.
  • Embed almost any online document to view without leaving your blog.

Donations for this plugin make up a chunk of my income. If you continue to enjoy this plugin, please consider making a donation. 🙂 Thank you for your support!

Quick start

Paste the URL of your public Google Spreadsheet or Google Apps Script Web App on its own line in your WordPress post or page, then save your post. That's it. 🙂 Your data will appear in a sorted, searchable HTML table. Web App output will be displayed using the HTML defined by the Web App. See the screenshots for an example.

If using a Google Spreadsheet, the spreadsheet must be shared using either the "Public on the web" or "Anyone with the link" options (learn how to share your spreadsheet). Currently, private Google Spreadsheets or Spreadsheets shared with "Specific people" are not supported. Web Apps must be deployed with the "Anyone, even anonymous" access permissions. CSV files must be available to the public, without the need to log in to the site where they're hosted.

Getting support

This document is the only support document for this plugin.

Due the sheer volume of repetitive posts asking questions that have already been answered in this document or by earlier postings on the support forum, I no longer volunteer any of my time to give support to users of this plugin under any circumstances beyond the documentation I have already produced.

In other words:

  • Do not email me expecting a reply. I will delete your email.
  • Do not post on the support forum expecting a reply from me. I will not read your posting and will therefore not respond.

There are more than ten years of questions and answers to those questions covering almost every conceivable use case and situation in which this plugin has been used or is likely to ever be used on the support forum that I have been present for. The meager amount of donations I receive for this plugin does not even register against the fathomingly high amount of effort I have put into monitoring support queries for this plugin. Worse, this effort was often in vain because the answers to the questions almost every single person who asked a question was seeking was already answered in this document or in a previous posting already. Enough is enough.

Your only options to get support for this plugin are:

  • actually read this document, or
  • use the Internet to search for answers previously answered elsewhere, or
  • seek help from someone other than me.

Hopefully, since no one can actually get my support any longer, more of them will do the thing they should have done in the first place and actually read this document, saving everyone involved a lot of time.

User guide

You can transform your spreadsheet into an interactive chart or graph, embed documents other than spreadsheets, and customize the HTML of your table using a [gdoc key=""] WordPress shortcode. The only required parameter is key, which specifies the document you'd like to retrieve. All additional attributes are optional.

Google Spreadsheets

After saving the appropriate Sharing setting, copy the URL you use to view the Google Spreadsheet from your browser's address bar into the shortcode. For example, to display the spreadsheet at https://docs.google.com/spreadsheets/d/ABCDEFG/edit#gid=123456, use the following shortcode in your WordPress post or page:

[gdoc key="https://docs.google.com/spreadsheets/d/ABCDEFG/edit#gid=123456"]

CSV files

Using a CSV file works the same way as Google Spreadsheets. Set the key to the URL of the file to display it as an HTML table:

[gdoc key="http://example.com/research_data.csv"]

HTML Tables

Customizing the HTML tables that are produced is easy. For instance, to supply the table's title, <caption>, and a customized class value, you can do the following:

[gdoc key="ABCDEFG" class="my-sheet" title="Tooltip text displayed on hover"]This is the table's caption.[/gdoc]

The above shortcode will produce HTML that looks something like the following:

<table id="igsv-ABCDEFG" class="igsv-table my-sheet" title="Tooltip text displayed on hover">
    <caption>This is the table's caption.</caption>
    <!-- ...rest of table code using spreadsheet data here... -->
</table>

By default, all tables are progressively enhanced with jQuery DataTables to provide sorting, searching, and pagination functions on the table display itself. If you'd like a specific table not to include this functionality, use the no-datatables class in your shortcode. For instance:

[gdoc key="ABCDEFG" class="no-datatables"]

Web addresses and email addresses in your data are turned into links. If this causes problems, you can disable this behavior by specifying no to the linkify attribute in your shortcode. For instance:

[gdoc key="ABCDEFG" linkify="no"]

Each table can be customized per-table, using shortcode attributes, or globally for your entire site, using the plugin's settings screen. You can freeze the table header, columns, control pagination length, and more. Refer to the Other Notes section for a full listing of supported customization attributes.

Charts

Data from Google Spreadsheets or CSV files can be graphed in interactive charts. To visualize your data as a chart, add the chart attribute to your shortcode and supply a supported chart type. You can make:

  • AnnotatedTimeLine charts
  • Annotation charts
  • Area charts
  • Bar charts
  • Bubble charts
  • Candlestick charts
  • Column charts
  • Combo charts
  • Gauge charts
  • Geo charts
  • Histogram charts
  • Line charts
  • Pie charts
  • Scatter charts
  • Stepped area charts
  • Timeline charts

For example, if you have data for a sports league that records the goals each team has scored (where the first column is the team name and the second column is their total goals), you can create a bar chart, with an optional title, from that data using a shortcode like this:

[gdoc key="ABCDEFG" chart="Bar" title="Total goals per team"]

You can customize your chart with a number of options, such as colors. For example, to create a 3D red and green pie chart whose slices are labelled with your data's values:

[gdoc key="ABCDEFG" chart="Pie" chart_colors="red green" chart_dimensions="3" chart_pie_slice_text="value"]

Pre-processing data with Google Queries

You can pre-process your Google Spreadsheets or CSV files before retrieving data from them by passing a Google Charts API Query Language query to the shortcode's query attribute. This lets you interact with the data in your Google Spreadsheet or CSV file as though it were a relational database table. For instance, if you wish to display the team that scored the most goals on your website, you might use a shortcode like this to query your Google Spreadsheet and display the highest-scoring team, where the team name is the first column (column A) and that team's score is the second column (column B):

[gdoc key="ABCDEFG" query="select A where max(B)"]

Queries are also useful if your spreadsheet contains complex data from which many different charts can be created, allowing you to select only the parts of your spreadsheet that you'd like to use to compose the interactive chart.

Using a MySQL Database

After an administrator enables the SQL queries option in the plugin's settings screen, privileged users can also retrieve data from the WordPress database by supplying the keyword wordpress to the key attribute of your shortcode along with a valid MySQL SELECT statement. This can be useful for displaying information that other plugins save in your website's database or that WordPress itself maintains for you.

For example, to show a table of user registration dates from the current blog:

[gdoc key="wordpress" query="SELECT display_name AS Name, user_registered AS 'Registration Date' FROM wp_users"]

Remote MySQL databases are also accessible by supplying a MySQL connection URL with valid access credentials. For example, to show the prices from an inventory database hosted by a MySQL server at server.example.com by logging in as user with the password password and querying for items that are in stock:

[gdoc key="mysql://user:password@server.example.com/inventory" query="SELECT sku AS 'Item No.', product_name AS Product, price AS Price WHERE in_stock=TRUE"]

Using Google Apps Script Web Apps

You can also supply the URL endpoint of any Google Apps Script Web App to retrieve the output from that app and insert it directly into your WordPress post or page. This works exactly the same way as Google Spreadsheets do, so you can use this feature to display arbitrary data on your WordPress site.

For example, suppose you maintain a GMail account for fans of your podcast to write you questions, and you want to automatically display some information from these emails on your website. Using GMail filters and labels, you can access these emails through a Google Apps Script that reads your email, counts the number of mail messages in your different labels, and returns that count as an HTML list fragment. Deploy that Google Apps Script as a Web App and supply its URL to the gdoc shortcode:

[gdoc key="https://script.google.com/macros/s/ABCDEFG/exec"]

Now your website is automatically updated whenever you receive a new question in email from your listeners.

Embedding other documents

You can also supply the URL of any file online to load a preview of that file on your blog. To do so, supply the file's URL as your key:

[gdoc key="http://example.com/my_final_paper.pdf"]

To tweak the way your preview looks, you can use the width, height, or style attributes:

[gdoc key="http://example.com/my_final_paper.pdf" style="min-height:780px;border:none;"]

Will my website be updated when my Google Spreadsheets change?

Yes. Changes you make to your Google Spreadsheets will be shown on your website within a few minutes.

To improve your website's performance, Inline Google Spreadsheet Viewer automatically caches spreadsheets for 10 minutes. If you are making many changes quickly and/or you don't want to wait for the cache to expire on its own, you can add the use_cache="no" attribute to your shortcode to disable the caching mechanism:

[gdoc key="ABCDEFG" use_cache="no"]

After you save and reload the page, you should see near-instant updates. Note that disabling the plugin's cache can result in decreased performance. Disabling the cache is recommended only for relatively small spreadsheets (less than 100 rows or so) or for debugging purposes.

The default style is ugly. Can I change it?

Yes, if you're able to change your theme's style sheet. The plugin renders HTML with plenty of CSS hooks. Use the igsv-table class from your style sheets to target the plugin's <table> element.

Additionally, each row (<tr>) and cell (<td>) is assigned a specific class attribute value. The first <tr> element is assigned the row-1 class, the second is assigned row-2, and the last row-N where N is the number of rows in the rendered table. Similarly, each cell is assigned a class based on its columnar position; the first cell in a row is assigned the col-1 class, the second col-2, and so on:

.igsv-table .row-2 .col-5 { /* styles for the cell in the 2nd row, 5th column */ }

Finally, both rows and cells (based on columns) are assigned an additional class of either odd or even, allowing for easy zebra-striping in CSS3 non-conformant browsers.

.igsv-table tr.odd  { /* styles for odd-numbered rows   (row 1, 3, 5...) */ }
.igsv-table tr.even { /* styles for even-numbered rows  (row 2, 4, 6...) */ }
.igsv-table td.odd  { /* styles for odd-numbered cells  (column 1, 3, 5...) */ }
.igsv-table td.even { /* styles for even-numbered cells (column 2, 4, 6...) */ }

A table appears, but it's not my spreadsheet's data! And it looks weird!

If you're still using the "old" Google Spreadsheets, you should triple-check that you've published your spreadsheet. Google provides instructions for doing this. Be sure to follow steps 1 and 2 in Google Spreadsheets Help: Publishing to the Web. If you're using the "new" Google Spreadsheets, be sure you've selected either the "Public on the web" or "Anyone with the link" Sharing options for your Google Spreadsheet.

A Google Login page appears where my Google Apps Script output should be.

If a Google Login page appears instead of the output of your GAS Web App, double check that you've deployed your Web App with the "Anyone, even anonymous" access permission. Learn more about GAS Web App permissions.

Nothing appears where my chart should be.

The best way to determine what's wrong with a chart that isn't displaying properly is to try displaying the chart's data as a simple HTML table (by removing the chart attribute from your shortcode), and seeing what the tabular data source looks like.

Charts most likely fail to display because of a mismatch between the chart you are using and the format of your spreadsheet.

Each type of chart expects to retrieve data with a certain number of rows and/or columns. If your Google Spreadsheet is not already designed to create data for a chart, you might be able to use the query attribute to select only the rows and/or columns that the chart you're using expects. Otherwise, consider creating a new sheet with the proper formatting and setting it as the key in your shortcode.

To learn more about the correct spreadsheet formats for each chart type, please refer to Google's Chart Gallery documentation for the type of chart you are using.

Can I remove certain columns from appearing on my webpage?

If you're using the "new" Google Spreadsheets, you can strip out columns by selecting only those columns you wish to retrieve by passing a Google Charts API Query Language query to the shortcode's query attribute. For example, to retrieve and display only the first, second, and third columns in a spreadsheet, use a shortcode like this:

[gdoc key="ABCDEFG" query="select A, B, C"]

Alternatively, you can hide columns using CSS with code such as, .col-4 { display: none; }, for example.

How do I change the default settings, like can I turn paging off? Can I change the page length? Can I change the sort order?

All of these DataTables options are accessible through shortcode attributes. The shortcode attribute is an underscore-separated version of the DataTables's CamelCase'ed option name, prefixed with datatables_. For instance, to turn off paging, you need to set the DataTables paging option to false, so you would use a shortcode like this:

[gdoc key="ABCDEFG" datatables_paging="false"]

Similarly, to change how many rows appear per page, you need to use the DataTables pageLength option, setting it to a number. Its default is 10, so if you wanted to show 15 rows per page, you would use a shortcode like this:

[gdoc key="ABCDEFG" datatables_page_length="15"]

Some DataTables options need to be given JavaScript array literals, such as in the case of the DataTables order option, which controls the initial sort order for a table. However, using square brackets ([ and ]) inside a shortcode confuses the WordPress parser, so these characters must be URL-escaped (into %5B and %5D, respectively). Suppose you want your table to be sorted by the second column in descending order (instead of the first column in ascending order, which is the default). You need to supply a 2-dimensional array such as [[ 1, "desc" ]] to DataTable's order option (column counting begins at 0). In a shortcode, with the square brackets URL-escaped, this becomes:

[gdoc key="ABCDEFG" datatables_order='%5B%5B 2, "desc" %5D%5D']

Note that when a JSON string literal is supplied in a shortcode attribute ("desc"), it must be double-quoted, so the shortcode attribute value itself must be single-quoted.

Alternatively, if you're able to add JavaScript to your theme, you can do all of these things, and more because any and all DataTables-enhanced tables can be modified by using the DataTables API.

For instance, to disable paging, add a JavaScript to your theme that looks like this:

jQuery(window).load(function () {
    jQuery('#igsv-MY_TABLE_KEY').dataTable().api().page.len(-1).draw();
});

Or, to have your DataTables-enhanced table automatically sort itself by the second column in descending order:

jQuery(window).load(function () {
    jQuery('#igsv-MY_TABLE_KEY').dataTable().api().order([1, 'desc']).draw();
});

(Replace MY_TABLE_KEY with the Google Spreadsheet document ID of your spreadsheet, of course.)

Please refer to the DataTables API reference manual for more information about customizing DataTables-enhanced tables.

Another option for sorting your table, for example, is to use the query attribute and pass along an appropriate Google Charts API Query Language query that includes an order by clause. In this case, however, you may want to disable DataTables's client-side sorting, as the data will be sorted in the HTML source.

How do I customize my chart?

Using specific shortcode attributes, you can choose from a huge number of configurable options to customize the look and feel of your chart. The specific shortcode attributes available to you depend on the type of chart you chose. Refer to the Google Chart API documentation to learn which configuration options are available for which type of charts.

Each configuration option is accessible through a shortcode of a similar name. For instance, the colors configuration option is accessible to you through the chart_colors attribute. It accepts a list of colors, which you supply to the shortcode in a similar way as you might provide a class value:

[godc key="ABCDEFG" chart="Pie" chart_colors="red green"]

To create a 3D chart, specify chart_dimensions="3".

With a few exceptions, the name of a shortcode attribute is always an underscore-separated translation of the camelCase name of the option in the Google Chart API. For instance, to disable chart interactivity by setting the chart's enableInteractivity option to false, use a shortcode like:

[gdoc key="ABCDEFG" chart="Pie" chart_enable_interactivity="false"]

Some configuration options call for an Object value. For these, the shortcode attribute value should be a JSON object. For instance, to use the different properties of the backgroundColor option:

[gdoc key="ABCDEFG" chart="Pie" chart_background_color='{"fill":"yellow","stroke":"red","strokeWidth":5}']

Note that when a JSON object is used as a value, the shortcode attribute's value must be single-quoted.

See Other Notes for a complete list of attribute for configurable chart options.

Why am I getting errors when I try to use the `query` attribute?

If your query includes an angle bracket, such as a less than (<) or a greater than (>) sign, WordPress will assume you are trying to write HTML and strip everything except the first word of your query, resulting in a syntax error. Instead, use the URL-encoded equivalents of these characters (%3C and %3E, for < and >, respectively), which WordPress will pass to the plugin unmolested and which the plugin is specifically aware of how to handle correctly.

How do I remove unneeded stylesheets or JavaScripts that this plugin adds?

Use the gdoc_enqueued_front_end_styles or gdoc_enqueued_front_end_scripts filter hooks. For instance, to prevent the plugin from enqueueing the JavaScript file for the Google Charts, use code like the following in your theme's functions.php file:

function igsv_dequeue_google_charts_script ($scripts) {
    unset($scripts['igsv-gvizcharts']);
    return $scripts;
}
add_filter('gdoc_enqueued_front_end_scripts', 'igsv_dequeue_google_charts_script')

See the Other Notes page for a full list of registered script and stylesheet handles this plugin uses.

0.13.2

  • Maintenance: Update DataTables libraries. No backwards incompatible changes are expected.

0.13.1

  • Enhancement: New csv_headers shortcode attribute adds support for Google Sheet Query Language HTTP endpoint headers parameter. Using csv_headers=1 in your shortcode may help if you find headers exported from a Google Sheet are missing.

0.13.0

  • Compatibility: Officially support WordPress 5.x and the Block Editor. This update removes the deprecated QuickTags integration from the Classic Editor and fixes minor author-side rendering bugs on WP 5.x.
  • Bugfix: Protect against "Undefined index" error when a user enters an incomplete key value.

0.12.9

  • Bugfix: Fix incorrect spacing causing invalid HTML table row markup.

0.12.8

  • Bugfix: Fix invalid HTML output affecting some CSS hooks.

0.12.7

  • Feature: Add HTML IDs to table rows. Thanks, @ThaiWood. 🙂
  • Bugfix: Compatibility with PHP 7.0 and later.

0.12.6

  • Update DataTables libraries to current release versions.
  • Minor code cleanup. (Fixes broken links in readme, code style, etc.)

0.12.5

  • Bugfix: Remove chart_legend_position attribute and update the documentation. This should be chart_legend with a JSON object attribute value.

0.12.4

  • Enhancement: Google Charts now accept fallback content as part of the shortcode like other options.
  • Bugfix: Support URL-encoded MySQL connection strings.
  • Security: MySQL datasources have been hardened, but their HTML IDs have changed. If you have styles or scripts looking for specific HTML IDs, you will need to update those resources to match the newly generated ID values.

0.12.3

  • Bugfix: Fix errors when using MySQL databse access shortcodes.

0.12.2

  • Feature: Support Google GeoCharts using the Geo chart type ([gdoc key="ABCDEFG" chart="Geo"]).
  • Bugfix: Exception handling no longer fails to return a human-readable error when using SQL data sources.

0.12.1

  • Bugfix: Fix regression during activation.

0.12

  • Automatically force new-style URLs for key attribute values that are still using deprecated old-style document IDs.
  • Bugfix: Fix collision with class names in some cases. This change requires the use of PHP 5.3 or later.


  1. Upload the unzipped inline-google-spreadsheet-viewer folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the 'Plugins' menu in WordPress.
  3. Use the [gdoc key="ABCDEFG"] shortcode wherever you'd like to insert the Google Spreadsheet.

Requirements

  • PHP 5.3 or later is required.


Use a Google Spreadsheet or create a new one for your WordPress post or page. Make sure the Spreadsheet is "Public on the web." Learn more about Google Docs sharing settings. If your spreadsheet was created a while ago and still uses an "old" style Google Spreadsheet, use the "Publish as a webpage" option. Make a note of the URL of your Google Spreadsheet's editing page.


Screenshot 1


On-screen help gives you instructions for using the plugin where you need it. Paste the address of your Google Spreadsheet into the key parameter of the plugin's shortcode ([gdoc key="YOUR_SPREADSHEET_URL_HERE"]), then save your post.


Screenshot 2


By default, Inline Google Spreadsheet Viewer produces a feature-rich HTML table on your site. Sort columns, filter rows, browse long tables by page number, show and hide individual columns, or export the table data in three different formats (CSV, Excel, and PDF). The plugin's ouput includes plenty of CSS and JavaScript hooks for unlimited customizability. Read the FAQ for coding details.


Screenshot 3


Transform your spreadsheet's data into an interactive graph or chart by adding a single shortcode attribute. More than a dozen chart types are supported, including Area, Bar, Column, Geo, Pie, Line, Scatter and more. Every chart can be customized with user-defined colors, opacity, and even 3D effects. There are over 50 configuration options to choose from. See the FAQ for a detailed list.


Screenshot 4


Use all the features of the Google Query Language to pinpoint the exact data you want. Over 50 additional configuration options let you customize the exact way your graphs, charts, and tables look.


Screenshot 5


This screenshot shows an example of what the previous screenshot might output with a given spreadsheet that contains data for the Aliens, Ninjas, Pirates, and Robots teams, and their player's respective points.


Screenshot 6



 

Click here to cancel reply.

Click here to cancel reply.


*

*


Please copy the string et5RlT to the field below:

Home | Sitemap | Contact
Network Skin Theme for BioShip by WordQuest
Password Reset
Please enter your e-mail address. You will receive a new password via e-mail.