Problem/Motivation

The handler extracts the sheet ID from #gid=123, but Google Sheets URLs can also include ?gid=123. Those currently validate but silently fall back to sheet ID 0.

Steps to reproduce

Use a URL like: https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit?gid=123
Expected: sheet ID 123 is stored.
Actual: sheet ID defaults to 0.

Proposed resolution

Parse the URL with parse_url() and support both fragment and query gid values.

Remaining tasks

Supports #gid=123.
Supports ?gid=123.
Supports URLs with both query params and fragment.
Adds test coverage.

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

elaman created an issue. See original summary.

elaman’s picture

Assigned: elaman » Unassigned
Status: Active » Needs review
nitinkumar_7’s picture

Ran through the test matrix and its solid - fragment-only, query-only, both together, noisy URLs with extra params (usp=sharing, range=A1), no-gid fallback to 0, bare URL, plus 4 invalid-URL cases. That's good coverage, I dont have obvious gaps to add.
One case I'd manually try that isn't in the provider: a URL with gid=0 explicitly in the query string, just to confirm it's distinguished correctly from "no gid found" - even though they resolve to the same value, I want to make sure thats by design and not a coincidence of the default.

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.