Skip to content

Comments

fix: Handle missing cell references#136

Open
bf4 wants to merge 1 commit intopythonicrubyist:masterfrom
bf4:fix_missing_r_cell
Open

fix: Handle missing cell references#136
bf4 wants to merge 1 commit intopythonicrubyist:masterfrom
bf4:fix_missing_r_cell

Conversation

@bf4
Copy link

@bf4 bf4 commented Feb 13, 2026

Summary

  • infer missing cell references from column order within a row
  • guard empty-cell padding when row or last column is missing
  • add regression fixture and spec for missing cell references

Testing

bundle exec rake

Closes #135

@bf4 bf4 changed the title Handle missing cell references fix: Handle missing cell references Feb 13, 2026
@stenlarsson
Copy link

@bf4 I also stumbled over this problem, but my fix is much simpler

diff --git a/lib/creek/sheet.rb b/lib/creek/sheet.rb
index 0c48fed..c6b5c86 100644
--- a/lib/creek/sheet.rb
+++ b/lib/creek/sheet.rb
@@ -120,6 +120,7 @@ module Creek
                 cell_type      = node.attributes['t']
                 cell_style_idx = node.attributes['s']
                 cell           = node.attributes['r']
+                cell ||= (cells.keys.last&.delete('0-9')&.succ || 'A') + row['r']
               elsif %w[v t].include?(node.name) && node.node_type == opener
                 unless cell.nil?
                   node.read

Your spec still passes. What do you think?

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.

Skip cells missing an "r" cell reference

2 participants