Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserting numeric values (making it possible to write serial number dates/times) #379

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Drowze
Copy link

@Drowze Drowze commented Jul 23, 2020

#380 - tests are passing

I had to patch Worksheet#[]= method to, instead of setting @numeric_values[[row, cel]] always to nil, to set it to the value itself if it's a numeric value or nil otherwise. Having the numeric value saved, I can use it on #save and that's enough for Google to parse the value as numeric if adequate.

Worksheet#[]= and Worksheet#[] APIs should be untouched, while Worksheet#numeric_value behaviour have changed a bit.

before:

ws[1, 1] = 8
ws[1, 2] = '8'
ws.numeric_value(1, 1) # => nil
ws.numeric_value(1, 2) # => nil
ws.synchronize
ws.numeric_value(1, 1) #=> 8
ws.numeric_value(1, 2) #=> 8

# if it's a date cell
ws[1, 3] = 8
ws[1, 4] = '8'
ws[1, 3] #=> '8'
ws[1, 4] #=> '8'
ws.synchronize
ws[1, 3] #=> '8'
ws[1, 4] #=> '8'

after:

ws[1, 1] = 8
ws[1, 2] = '8'
ws.numeric_value(1, 1) # => 8
ws.numeric_value(1, 2) # => nil
ws.synchronize
ws.numeric_value(1, 1) #=> 8
ws.numeric_value(1, 2) # => 8

# if it's a date cell
ws[1, 3] = 8
ws[1, 4] = '8'
ws[1, 3] #=> '8'
ws[1, 4] #=> '8'
ws.synchronize
ws[1, 3] #=> 7/1/1900 # or whatever is the date format on the cell
ws[1, 4] #=> '8'

Drowze added a commit to Drowze/aspirebudgeting_ruby that referenced this pull request Jul 24, 2020
PR open at:
gimite/google-drive-ruby#379

Also updated the spreadsheet mock with a way to input serial dates.
Drowze added a commit to Drowze/aspirebudgeting_ruby that referenced this pull request Jul 24, 2020
PR open at:
gimite/google-drive-ruby#379

Also
- Update the spreadsheet mock with a way to input serial dates.
- Remove core_extensions from coverage report.
Numeric values should added as-is and not converted to strings.
This is specially important if the user is trying to add dates
in their serial form.
Drowze added a commit to Drowze/aspirebudgeting_ruby that referenced this pull request Jul 25, 2020
PR open at:
gimite/google-drive-ruby#379

Also
- Update the spreadsheet mock with a way to input serial dates.
- Remove core_extensions from coverage report.
Drowze added a commit to Drowze/aspirebudgeting_ruby that referenced this pull request Jul 28, 2020
PR open at:
gimite/google-drive-ruby#379

Also
- Update the spreadsheet mock with a way to input serial dates.
- Remove core_extensions from coverage report.
- Remove CoreExtensions::Worksheet rubocop checking
Drowze added a commit to Drowze/aspirebudgeting_ruby that referenced this pull request Jul 28, 2020
PR open at:
gimite/google-drive-ruby#379

Also
- Update the spreadsheet mock with a way to input serial dates.
- Remove core_extensions from coverage report.
- Remove CoreExtensions::Worksheet rubocop checking
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.

1 participant