Overview
Hyogen converts CSV or Excel data to Ruby objects or any text. This package is like Java’s XLSBeans library.
Here is how do you it
Start with a very simple example.
Input
Input data is CSV or Excel format data. The data have to include table tag. Hyogen converts input data to array of Table class object. Table class is set of Record class. Record class is a row of table.
{VTABLE}User List
{L}id, name, gender
1, Taro, male
2, Hanko, female
3, Ichiro, male
Template
Template format is erb.
<%- table = tables.first -%>
<%- for record in table.records -%>
My name is <%= record["name"] %>. I'm <%= record["gender"] %>.
<%- end -%>
Output
My name is Taro. I'm male.
My name is Hanko. I'm female.
My name is Ichiro. I'm male.
Table tag
- VTABLE
-
This tag means start of table and the line of records is vertical.
- HTABLE
-
This tag means start of table and the line of records is horizontal.
- L
-
This tag means start of label.
- N
-
This tag means
- <>
-
This tag means
Install
require ParseExcel