Skip to content

fix: allow stringValue setter to accept strings starting with =#750

Merged
theoephraim merged 2 commits intomainfrom
fix/string-value-formula-prefix
Feb 14, 2026
Merged

fix: allow stringValue setter to accept strings starting with =#750
theoephraim merged 2 commits intomainfrom
fix/string-value-formula-prefix

Conversation

@theoephraim
Copy link
Copy Markdown
Owner

Summary

  • Allow cell.stringValue to accept strings starting with =, storing them as literal string values instead of throwing an error
  • Previously, setting cell.stringValue = '=SUM(A1:A5)' would throw "Use cell.formula to set formula values" — but users explicitly using stringValue want to store the value as a plain string, not a formula
  • Directly sets _draftData.valueType = 'stringValue' to bypass the auto-detection in the value setter

Fixes #644, incorporates #643

Test plan

  • Added integration tests for stringValue setter with = prefixed strings
  • Added integration test for regular string via stringValue setter
  • Run bun vitest run src/test/cells.test.ts to verify against real Google APIs

🤖 Generated with Claude Code

Previously, setting cell.stringValue to a string starting with "="
threw an error. Now it stores the value as a literal string by
directly setting the valueType to "stringValue", bypassing the
auto-detection in the value setter.

Closes #644, incorporates #643

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 14, 2026

🦋 Changeset detected

Latest commit: 900ea8f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
google-spreadsheet Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Use "=2+2" as test value so we can clearly verify the literal string
is stored (not computed as 4), and check formattedValue matches.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@theoephraim theoephraim merged commit 557ce16 into main Feb 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Save a formula or any string which starts with "=" as a string using the cells-based interface

1 participant