0

I have been using axlsx gem in ruby for exporting data in spreadsheet file. I have more than 1000 of rows of data. Each row of data are the records from the database and has a unique id. I have already exported the records in a spreadsheet file which is in following format.

Students_name Subject Marks Remark
 Ted          Maths   80    Pass
 Lily         Maths   90    Pass
 John         Science 30    Fail
 Ted          Science 30    Fail
 John         English 70    Pass

Here, the data in column students_name are being repeated.I want to change the view of the spreadsheet file into the following format.

Students_name Subject Marks Remark
 Ted          Maths   80    Pass
              Science 30    Fail

 John         Science 30    Fail
              English 70    Pass

 Lily         Maths   90    Pass

I have 1000s of data so i cant sort the data based on repeated values and merge the cells manually. How can I solve this?

1 Answers1

0

The first question is how you get this data?

If you take it from database you cat use group_by method for grouping by students_name

If all your data came from file, you may parse it in memory by parts. I think you will not have problems with parsing it by parts in different files. (like Ted, John, Lily, etc) and bundle it after. Of course it will be very slow, but it will work

Unfortunately, your task is not full, and, I think, it is the fullest answer that you can get with this incoming data

Mike Belyakov
  • 1,355
  • 1
  • 13
  • 24