# Using SheetPoet Operations

This guide explains how to use the different operations available in the SheetPoet Google Sheets Add-on.

# Available Operations

SheetPoet offers three main types of operations:

Operation Purpose Data Flow Behavior
Import data to sheet Retrieve data from WordPress WordPress → Google Sheets Runs recursively until cancelled or empty return
Update data on website Send data to WordPress Google Sheets → WordPress Supports dynamic column values (, , etc.)
Run one-time trigger Execute standalone operations No specific data flow Runs once and inserts data into selected sheet

# Import Data to Sheet

Use this to fetch data from WordPress and display it in your spreadsheet. This operation runs recursively until you cancel it or the function returns an empty result.

# Steps:

  1. Click Extensions > SheetPoet - WordPress Connector > Operations > Import data to sheet
  2. Select the WordPress site you want to connect to
  3. Select the Sheet in which you want to import the data (all data will be read and saved in this sheet)
  4. In the Function dropdown, select the function you created in WordPress
  5. Add Magic Parameters which are key-value pairs your function will have access to (e.g., if you add test as key and 1 as value, the function can access it as $record['test'] with value 1)
  6. Choose the batch size (number of rows fetched in each API call)
  7. Click Process
  8. Your WordPress data will start appearing in the spreadsheet
  9. You can stop the process at any time by clicking Stop

# Default Parameters Available:

Your function automatically receives: index, processed, batchSize

The operation will continue running until:

  • You click Stop
  • Your function returns an empty array or value
  • An error occurs

# Update Data on Website

Use this to send data from your spreadsheet to WordPress for processing. This operation supports dynamic column values, allowing you to map any spreadsheet column to your function parameters.

# Steps:

  1. Click Extensions > SheetPoet - WordPress Connector > Operations > Update data on website

  2. Select the WordPress site you want to connect to

  3. Select the function you created in WordPress

  4. Configure parameters and map your spreadsheet data using dynamic column values

  5. Add Magic Parameters with column references. For example:

    key value
    title {{A}}
    content {{B}}
    category {{C}}
  6. Click Process

# Default Parameters Available:

Your function automatically receives: index, batchSize, identifier

# Dynamic Column Mapping:

Use {{COLUMN}} syntax to reference spreadsheet columns:

  • {{A}} = Column A value
  • {{B}} = Column B value
  • {{C}} = Column C value
  • And so on...

Example: Set magic parameter title with value {{A}} to pass Column A value as the "title" parameter to your function.

# Run One-time Trigger

Use this to execute standalone functions on your WordPress site. This operation runs once and inserts the returned data into the selected sheet.

# Steps:

  1. Click Extensions > SheetPoet - WordPress Connector > Operations > Run one-time trigger
  2. Select the WordPress site you want to connect to
  3. Select the function you want to trigger
  4. Configure any required parameters using Magic Parameters
  5. Click Process

# Default Parameters Available:

No default parameters (only custom magic parameters you define)

The function will execute once on your WordPress site and return results to your spreadsheet. This is perfect for:

  • Maintenance tasks
  • Data analysis
  • One-time data exports
  • System status checks

# Working with Magic Parameters

Magic Parameters are key-value pairs that your function will have access to. They provide additional context or configuration for your functions.

# How to Add Magic Parameters:

  1. In the operation interface, locate the "Magic Parameters" section
  2. Click Add New Field
  3. Enter a key and value for your parameter

# Examples:

Static Values: If you add test as the key and 1 as the value, your function can access it as $record['test'] and it will have the value of 1.

Dynamic Column Values (Upload to Website only):

  • Key: title, Value: {{A}} → Function receives Column A value as $record['title']
  • Key: content, Value: {{B}} → Function receives Column B value as $record['content']
  • Key: category, Value: {{C}} → Function receives Column C value as $record['category']

# Default Parameters by Function Type:

  • Import to Sheet: index, processed, batchSize
  • Upload to Website: index, batchSize, identifier
  • One-time Trigger: No default parameters

Common magic parameters include:

  • id: Unique identifier for the data
  • status: Content status (e.g., "publish", "draft")
  • type: Content type

# Saving Operations as Presets

To save an operation for future use:

  1. Configure your operation
  2. Click Save as Preset
  3. Enter a name for your preset
  4. Click Save

To use a saved preset:

  1. Click Extensions > SheetPoet - WordPress Connector > Presets
  2. Find your preset in the list
  3. Click Use
  4. Click Process to execute

# Troubleshooting

# Operation Errors

  • Check the error message for specific issues
  • Verify your data format matches what the function expects
  • Try with a smaller dataset to isolate the issue
  • Check execution history in WordPress for detailed error information

For more help, see our Troubleshooting Guide.