Closed ardavis closed 8 years ago
What good would this feature do? Also, spreadsheet gem does NOT parse XLSX files. For that you need to use https://github.com/weshatheleopard/rubyXL gem.
That's okay. We are currently parsing .xls files, they are fairly old templates. Basically by allowing the ability to find a cell by it's name, it can let the template designers modify the template however they see fit. If they feel a cell needs to be moved, then they can move it and it won't affect our ability to ingest the file.
Secondly, new columns often get added to the templates that we ingest. Here is some pseudo code of how we ingest it:
# Column locations
NAME = 4
ADDRESS = 5
PHONE = 6
....
rows.each do |row|
self.name = row[NAME]
self.address = row[ADDRESS]
self.phone = row[PHONE]
end
Unfortunately if the template gets changed, and FAVORITE_COLOR
were to be added right after name, now we have to modify the column locations for all cells after it.
We have about 80 columns, so when things get added, it's a massive pain to change all of those numbers. If we could instead retrieve NAME_HEADER
or something, then we could figure out what column it's in, regardless of where it is in the Excel file.
Ok, we will think about this but I do not think this will be easy.
That's understandable. I wasn't sure, that's why I figured I'd ask. Thanks for even considering.
I will close this, but that does not mean the feature will not be implemented.
Is there a way to retrieve the contents of a cell by it's name, instead of just the row/col? This would make future changes to the spreadsheet easier for my application.
Reference: Stack Overflow Question
If it doesn't currently exist, is there a relatively simple way to patch the gem to accommodate?