title: golang convert excel sheet to a struct
body: <p>I tried to use <a href="https://github.com/tealeg/xlsx" rel="nofollow noreferrer">https://github.com/tealeg/xlsx</a> and <a href="https://github.com/360EntSecGroup-Skylar/excelize" rel="nofollow noreferrer">https://github.com/360EntSecGroup-Skylar/excelize</a>
  I success to read from excel file</p>
  <pre><code>package main
  
  import (
      &quot;fmt&quot;
  
      &quot;github.com/360EntSecGroup-Skylar/excelize&quot;
  )
  
  func main() {
      f, err := excelize.OpenFile(&quot;Book1.xlsx&quot;)
      if err != nil {
          fmt.Println(err)
          return
      }
      // Get value from cell by given worksheet name and axis.
      cell, err := f.GetCellValue(&quot;Sheet1&quot;, &quot;B2&quot;)
      if err != nil {
          fmt.Println(err)
          return
      }
      fmt.Println(cell)
      // Get all the rows in the Sheet1.
      rows, err := f.GetRows(&quot;Sheet1&quot;)
      for _, row := range rows {
          for _, colCell := range row {
              fmt.Print(colCell, &quot;\t&quot;)
          }
          fmt.Println()
      }
  }
  </code></pre>
  <p>put I want to convert data from excel to Array of defined struct</p>
  <p>example</p>
  <pre><code>type InvoiceSheet struct {
      amount string
      item   string
     
  }
  
  var invoices []InvoiceSheet
  
  err := excel.READMETHOD('path of file', &amp;invoices)
  </code></pre>
  <p>then I can iterate invoices</p>