Knowledge base

Creating a Shortcode in Spreadsheet Reader

With Spreadsheet Reader, you can create shortcodes to display your Google Sheets data on your WordPress site. Follow these steps to generate a shortcode:

Step 1: Go to the Settings Page

  1. Navigate to WordPress DashboardSettingsSpreadsheet Reader
  2. Click the “Add Shortcode” button to open the shortcode creation popup.

Step 2: Fill in the Required Fields

In the popup, enter the following details:

  • Shortcode Name – A unique identifier for your shortcode. This name will be used to call the shortcode in your posts/pages.
  • Spreadsheet ID – The unique ID of your Google Sheet. Click here to learn how to get the Spreadsheet ID.
  • Sheet Name – The exact name of the sheet (tab) within your Google Spreadsheet (e.g., Sheet1).
  • Cell Location – Define the cell range to be fetched (e.g., A1:Z100).
  • Enable Cache? – Check this box to enable caching, which helps reduce API calls and improves performance.

Step 3: Cache Duration Recommendations

Caching stores the spreadsheet data temporarily to prevent excessive API requests. The cache duration depends on how often your data changes:

  • For frequently updated data (e.g., live stock prices, real-time orders) → Set cache duration to 5–15 minutes
  • For daily updates (e.g., reports, schedules) → Set cache duration to 1–6 hours
  • For rarely changing data (e.g., static reference tables) → Set cache duration to 1 day or more

Step 4: Using the Shortcode

Once added, you can use the shortcode in your posts, pages, or widgets.

[spreadsheet_table id=”YOUR_SHORTCODE_NAME” col_limit=”0″ row_limit=”0″]

  • spreadsheet_table → Show data as table.
  • id → Shortcode Name you created (e.g., contact).
  • col_limit → Limit the columns (set “0” to unlimit column).
  • row_limit → Limit the rows (set “0” to unlimit row).

Example:

  • [spreadsheet_table id=”contact” col_limit=”3” row_limit=”5“]
  • If col_limit=”3″ and row_limit=”5″, the table will display only the first 3 columns and 5 rows of data.

Example 2:

Your Spreadsheet data
Your Shortcode
The result

Fetch a Single Data Cell:

[spreadsheet_data id=”YOUR_SHORTCODE_NAME” col=”0″ row=”0″]

  • spreadsheet_data → Show data as a single value in specific row & column.
  • id → Shortcode Name you created (e.g., contact).
  • col → Column in your data range (index starts from 0).
  • row → Row in your data range (index starts from 0).

Understanding Column & Row Index:
If your selected range is A1:E9, then:

  • col=0, row=0 → refers to A1
  • col=1, row=0 → refers to B1
  • col=0, row=1 → refers to A2

(See illustration below for column & row indexing.)

Format in “column, row”

Example 1:

  • Column 0, Row 0 → A1 (“First Name”)
  • Column 1, Row 0 → B1 (“Last Name”)
  • Column 0, Row 1 → A2 (“John”)
  • Column 1, Row 1 → B2 (“Doe”)
  • Column 2, Row 3 → C4 (“35”)

Example 2:


Now you’re ready to display Google Sheets data on your WordPress site with ease!