I am a real person that used AI to write this bug report. The information is accurate and describes an issue I encountered while trying to use this module to sync data from webforms to google sheets. I've attached a patch that corrected the issue on my end.

Problem/Motivation

When a webform contains a textarea with a text format enabled (e.g., "Plain text", "Basic HTML"), the Google Sheets handler silently drops the field's value from the submission data sent to the spreadsheet. All other fields submit correctly, but text format fields are missing with no error or warning.

This occurs because Drupal stores text format field values as an associative array (['value' => '...', 'format' => 'plain_text']) rather than a plain string. In WebformGoogleSheetsHandler::getData(), the !is_array($value) check on line 546 causes these fields to fall into the array processing branches (composite, likert, webform_multiple), none of which match, so the value is never added to $flat_data.

Steps to reproduce

  1. Create a webform with a Textarea element.
  2. On the element's settings, set Text format to any format (e.g., "Plain text").
  3. Add a Google Sheets handler to the webform and ensure the textarea field is included under "Submission data."
  4. Submit the webform.
  5. Check the Google Sheet — the textarea column will be empty while all other non-text-format fields are populated correctly.

Proposed resolution

Before the !is_array($value) single-value check, detect text format field arrays by checking for the presence of both 'value' and 'format' keys. If matched, extract the 'value' key so the field is treated as a plain string and processed normally.

if (is_array($value) && array_key_exists('value', $value) && array_key_exists('format', $value)) {
$value = $value['value'];
}

Remaining tasks

Review and commit the patch.

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
webform-googlesheets-text-format-fields.patch710 bytesrobv
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

robv created an issue. See original summary.

robv’s picture

Issue summary: View changes

elaman made their first commit to this issue’s fork.

elaman’s picture

Status: Active » Needs review

I've added some unit tests to go with it.

  • elaman committed a0bbe560 on 2.x
    Resolve #3576835 "Textareas with text"
    
elaman’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

elaman’s picture

Status: Fixed » Needs review

The formatted text fix changes the number of cells exported by existing handlers because these elements were previously selected but silently omitted.

MR !35 adds a post-update that excludes single-value formatted text elements from existing Google Sheets handlers. This preserves the existing spreadsheet column layout after an upgrade. Administrators can select the fields again after adding the corresponding columns to their sheets. New handlers are not affected.

The update is covered by a kernel test that also confirms ordinary text fields remain selected.

  • elaman committed 34328998 on 2.x
    Issue #3576835: Preserve columns when enabling formatted text
    
elaman’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.