Beschrijving
SheetMirror embeds a live Google Sheets spreadsheet into any WordPress post or page using a simple shortcode. Unlike basic CSV importers, SheetMirror can connect to the Google Sheets API v4 to retrieve not just your data, but the full visual formatting of every cell – giving your readers a table that looks exactly like the one you designed in Google Sheets.
Why SheetMirror ?
Spreadsheet data on the web is often reduced to a bland, unstyled grid. The formatting you spent time on – the bold headers, the colour-coded rows, the carefully aligned columns – disappears entirely. SheetMirror solves this by faithfully translating your Google Sheets formatting into standard HTML and inline CSS, so the table your readers see on your site is a true reflection of the original.
Two Fetch Modes
API Mode (recommended)
Uses the Google Sheets API v4 to retrieve both cell values and full formatting metadata. A Google Cloud API key is required. This is the mode that enables all the rich formatting features described below.
CSV Mode (no API key needed)
Fetches data via Google’s public CSV export URL. No API key or account is required – just share your sheet as “Anyone with the link can view.” Cell values are displayed in a clean, readable table, without formatting. Ideal for simple data tables where styling is not a priority.
Formatting Reproduced via the API
When API Mode is enabled, SheetMirror retrieves and applies the following formatting properties from your spreadsheet:
- Horizontal alignment – Left, Centre, Right, and Justify, applied per cell.
- Vertical alignment – Top, Middle, and Bottom.
- Text decoration Bold (<strong>), italic (<em>), underline (<u>), and strikethrough (<s>), each rendered using the appropriate semantic HTML element.
- Font family – The typeface specified in the spreadsheet is passed through as a CSS font-family value.
- Font size – Rendered as pt values, matching the size as set in Google Sheets.
- Font colour – Foreground text colour is reproduced as a CSS color value.
- Cell background colour – Background fill colours are rendered as CSS background-color values. The default white background and black text are always output explicitly so that theme styles cannot bleed through.
- Merged cells – Merge regions are faithfully reproduced using HTML rowspan and colspan attributes.
- Cell borders – Per-cell border styles (solid, dashed, dotted, double) and weights (1 px, 2 px, 3 px) are applied as individual CSS border-{side} declarations.
- Text wrap strategy – Wrap and Clip modes are translated to the appropriate CSS white-space and overflow rules. The Overflow mode (where content spills into adjacent cells) is a layout behaviour specific to Google Sheets and cannot be reproduced in an HTML table.
- Text direction – Right-to-left text is reproduced with the CSS direction: rtl property.
- Hyperlinks – Both cell-level hyperlinks and links set via the Google Sheets link format are rendered as <a> tags with target=”_blank” rel=”noopener noreferrer”.
- Column widths – Each column’s pixel width is retrieved from the spreadsheet and applied via <colgroup> elements, reproducing the exact column proportions of the original. Active when the “Auto-fit columns” option is off (the default).
- Row heights – Each row’s pixel height is retrieved and applied as an inline height style on the <tr> element, preserving the vertical spacing of the original spreadsheet. Active when the “Auto-fit columns” option is off (the default).
- Hidden rows and columns – Rows and columns that are hidden in the spreadsheet (whether hidden manually or by a filter) are omitted from the rendered table entirely. Available in API mode only.
- Mixed format – Cells containing mixed formatting within a single cell (rich text) are fully supported in API mode. Font size, font family, style, and colour can all vary within a single cell; each run is rendered as an individual <span> with its own styles applied.
Table Display Options
Each registered table can be configured independently with the following options:
- Use Google Sheets API – Toggle between API Mode (full formatting) and CSV Mode (values only).
- Shrink to fit – Available in API + fixed-width mode only. When enabled, the table is automatically scaled down in the browser to fit the available container width. Inline px and pt values are rewritten directly – the same arithmetic as the
scaleshortcode attribute – so theme styles, borders, and background colours are unaffected. Mutually exclusive with “Auto-fit columns”. - Auto-fit columns – When off (default), column widths are taken directly from the spreadsheet’s pixel dimensions via the API, reproducing the layout as designed in Google Sheets. When on, each column shrinks to fit its content (
table-layout: auto). Mutually exclusive with “Shrink to fit”. - Treat first row as header – Renders the first row inside a
<thead>element using<th>cells withscope="col", improving accessibility and allowing header-specific styling. Available in CSV mode only. - Borderless – Hides all cell borders for a cleaner, minimal presentation. When off, a standard 1 px grid is shown as a fallback, with per-cell API borders taking priority where available. Available in CSV mode only.
Caching
All API and CSV responses are cached using WordPress transients for 5 minutes, keeping your page loads fast and your API quota usage low. A “Clear Cache” button is available for every registered table so you can force a refresh immediately after updating your spreadsheet.
Shortcode Usage
After registering a table in Settings SheetMirror, embed it anywhere using its tag name as a shortcode:
[your_tag_name]
For example, if you registered a table with the tag sales_2026, place [sales_2026] in any post, page, or widget area.
Scaling the table
An optional scale attribute lets you render the table at a percentage of its original size. Accepted values are integers between “10” and “200”.
[sales_2026 scale="50"]
The scaling is applied via the CSS font-size property on the wrapper element (and, in fixed-width API mode, by multiplying each column width and row height by the scale factor).
Table alignment
An optional align attribute lets you control the horizontal alignment of the table within its container. Accepted values are “left”, “center”, and “right”.
[sales_2026 align="left"]
The align attribute can also be combined with the scale option:
[sales_2026 align="center" scale="80"]
If the attribute is omitted, the table will follow the default alignment defined by your theme or container styles.
Requirements
- A Google Sheets spreadsheet shared as “Anyone with the link can view.”
- For API Mode: a Google Cloud API key with the Google Sheets API enabled.
External Services
This plugin connects to external services operated by Google. Depending on the fetch mode you choose, one or both of the following connections will be made.
Google Sheets API v4 (API Mode)
When API Mode is enabled, this plugin sends requests to the Google Sheets API v4 to retrieve cell values and formatting metadata from your spreadsheet.
- Service: Google Sheets API v4, provided by Google LLC.
- Data sent: The Spreadsheet ID and cell range you registered, together with your Google Cloud API key. No personal data of your site’s visitors is transmitted.
- When: Every time a page containing the shortcode is loaded and no valid cached response exists (cache duration: 5 minutes). A request is also made when you use the connection-test button in the settings page.
- Terms of Service: https://developers.google.com/terms
- Privacy Policy: https://policies.google.com/privacy
Google Sheets CSV Export (CSV Mode)
When CSV Mode is enabled, this plugin fetches data from Google’s public CSV export URL for your spreadsheet.
- Service: Google Sheets public CSV export (
/export?format=csv), provided by Google LLC. - Data sent: The Spreadsheet ID and numeric sheet identifier (gid). No API key or visitor data is transmitted.
- When: Every time a page containing the shortcode is loaded and no valid cached response exists (cache duration: 5 minutes).
- Terms of Service: https://policies.google.com/terms
- Privacy Policy: https://policies.google.com/privacy
Google Sheets Sheet List (CSV Mode – sheet name resolution)
When CSV Mode is enabled and a sheet name is specified in the cell range, this plugin fetches the spreadsheet’s HTML view page in order to resolve the sheet name to its numeric identifier (gid). This request is made once per spreadsheet and the result is cached together with the table data.
- Service: Google Sheets HTML view page (
/htmlview), provided by Google LLC. - Data sent: The Spreadsheet ID only. No API key or visitor data is transmitted.
- When: On the first load of a page containing a CSV Mode shortcode that specifies a sheet name, when no valid cached response exists. Not used when a gid is available directly from the registered URL, or when API Mode is enabled.
- Terms of Service: https://policies.google.com/terms
- Privacy Policy: https://policies.google.com/privacy
Donate
If you find this plugin useful and would like to support its development,
you can make a voluntary donation via PayPal.
Your support helps keep this plugin maintained and improved.
Thank you!
PayPal: https://www.paypal.me/Kasuga16
Schermafbeeldingen
Installatie
- In your WordPress admin dashboard, go to Plugins Add New.
- Click Upload Plugin, choose the
sheetmirror-for-google-sheets.zipfile, and click Install Now. - After installation, click Activate Plugin.
- Navigate to Settings SheetMirror.
- (API Mode only) Enter your Google Cloud API key and click Save.
- Click Register New Table, fill in the tag name, spreadsheet URL, and cell range, then click Register.
- Place the shortcode
[your_tag_name]in any post or page.
Getting a Google Cloud API Key
- Open the Google Cloud Console.
- Create a new project (or select an existing one).
- Go to APIs & Services Library and enable the Google Sheets API.
- Go to APIs & Services Credentials and click Create Credentials API Key.
- Copy the key and paste it into Settings SheetMirror API Key.
For security, it is recommended to restrict your API key to the Google Sheets API and to your site’s server IP address in the Google Cloud Console.
FAQ
-
Do I need an API key to use this plugin?
-
No. CSV Mode works without any API key – just share your spreadsheet as “Anyone with the link can view” and register the table with the “Use Google Sheets API” option turned off. Cell values will be displayed without formatting.
-
Why does my table look different from the one in Google Sheets?
-
SheetMirror reproduces all formatting that is exposed by the Google Sheets API v4. Some visual elements – such as conditional formatting rules and sparklines – are not part of the cell-level formatting data returned by the API and therefore cannot be replicated.
Also note that font families specified in your spreadsheet may not be available on your visitors’ devices. In that case the browser will fall back to the sans-serif system font.
-
Can I register more than one table?
-
Yes. You can register as many tables as you like, each with its own tag, URL, range, and display options. Every table gets its own shortcode.
-
What cell range format should I use?
-
Standard A1 notation is supported. Examples:
A1:D10– a range on the default sheetSheet1!B2:E20– a range on a named sheet
-
Is the plugin compatible with the Block Editor (Gutenberg)?
-
Yes. Place the shortcode inside a Shortcode block, or use it in the Classic block. The table will render on the front end exactly as configured.
-
My spreadsheet contains sensitive data. Is it safe to use CSV Mode?
-
CSV Mode fetches data from Google’s public export URL, which means anyone with the spreadsheet URL can view the data. Only use CSV Mode (or API Mode) with spreadsheets you are comfortable making publicly readable. Always use the “Anyone with the link can view” sharing permission rather than “Public on the web” where possible.
Beoordelingen
Bijdragers & ontwikkelaars
“SheetMirror for Google Sheets” is open source software. De volgende personen hebben bijgedragen aan deze plugin.
BijdragersVertaal “SheetMirror for Google Sheets” in je eigen taal.
Interesse in ontwikkeling?
Bekijk de code, haal de SVN repository op, of abonneer je op het ontwikkellog via RSS.
Changelog
1.3.0
- New: “Shrink to fit” toggle added to the admin settings (API + fixed-width mode only). When enabled, the table is automatically scaled down in the browser to fit the available container width. Inline px and pt values are rewritten directly – the same arithmetic as the
scaleshortcode attribute – so theme styles, borders, and background colours are unaffected. - New: “Auto column width” renamed to “Auto-fit columns”; “Shrink to fit” toggle added (API + fixed-width mode only) to automatically scale the table down to fit its container width. Toggle options now disable contextually to prevent incompatible combinations.
1.2.3
- Bug fix: Google Fonts were incorrectly requested for Japanese system fonts and for fonts specified within rich-text runs; font family names are now encoded correctly with
urlencode(). The ignore list and generated URL are both filterable via WordPress hooks.
1.2.2
- Improvement: API mode now supports rich-text (mixed formatting) cells. When a cell contains runs with different font sizes, colours, or styles, each run is rendered as an individual
<span>with its own inline styles rather than applying a single format to the entire cell value.
1.2.1
- Bug fix: an issue with the hidden rows and columns feature introduced in 1.2.0, where they were incorrectly rendered in API mode; they are now properly skipped.
- Added optional align shortcode attribute (left, center, right) to control table alignment within its container.
1.2.0
- Bug fix: border weight (
SOLID_MEDIUM/SOLID_THICK) was dropped due to underscores being stripped bysanitize_key(). - Bug fix: fixed-width API mode border weight inconsistency resolved by switching all tables to
border-collapse: collapse. - Bug fix: in-cell line breaks (Ctrl+Enter in Google Sheets) were not rendered in HTML.
- New: hidden rows and columns (hidden via Google Sheets row/column hide or filter) are now skipped in API mode and not rendered in the HTML table.
- Improvement: API mode text colour and background colour are now fully isolated from theme styles.
1.1.1
- Bug fix: cache clear not working when URL contains a sheet gid.
1.1.0
- Bug fix: merged cells rendered incorrectly due to double-application of range start offset.
- Bug fix: black cell backgrounds were incorrectly suppressed and rendered as transparent.
- Improvement: API-mode inline styles for alignment, colours and borders are no longer overridden by CSS rules that were scoped too broadly.
- Improvement: API + Auto-width mode overhauled – now uses
table-layout: auto,width: 100%,border-collapse: collapse, and correctly applies text alignment, vertical alignment, borders, and font matching via Google Fonts. - New: pubhtml (“Publish to web”) URLs are now supported in CSV mode.
- New: Sheet gid field added to the registration form (CSV mode only; disabled in API mode).
1.0.0
- Initial release.
- Added optional
scaleshortcode attribute (10 – 200) to resize a table without affecting the surrounding page layout. - API Mode: full cell formatting via Google Sheets API v4.
- CSV Mode: value-only fetch with no API key required.
- Supports alignment, text decoration, font family/size, colours, merged cells, borders, text wrap (Wrap & Clip), RTL text, and hyperlinks.
- Per-table options: header row, auto/fixed column width, borderless mode.
- Column widths and row heights reproduced from spreadsheet pixel dimensions in fixed (default) mode.
- WordPress transient caching with manual clear-cache button.
- AJAX connection test for API key and range validation.
- Live shortcode tag preview in the registration form.




