0

This is a concept question regarding data structures in ruby. I would like to iterate through rows of a spreadsheet. There are gems to do this, but I want to understand the difference between allocating a row as a hash of arrays (where the first column is the key and the rest of them the value as array) and just having a row as an array. Does it matter?

2
  • It is not clear what you mean by "a row as a hash of arrays (where the first column is the key and the rest of them the value as array)". Commented Sep 6, 2015 at 10:11
  • Your title is also confusing. Do you mean to represent "the spreadsheet with array of arrays"? Commented Sep 6, 2015 at 10:15

1 Answer 1

1

It really depends on what you want to do with the result.

Representing a spreadsheet as an array of arrays means determining the meaning of each cell positionally, which is more complex than using a hash. But if you don't care about the meaning and just wanted to write the data to a csv for example, then an array of arrays would be suitable.

So think about what you actually want to do with the data in the future.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.