package util

import "github.com/tealeg/xlsx"

// 解析xlsx文件
func ParseXlsx(xlFile *xlsx.File) [][]string {
	sheet := xlFile.Sheets[0]
	rowLength := len(sheet.Rows)
	cellLength := len(sheet.Cols)
	arr := make([][]string, rowLength)
	for i := range arr {
		arr[i] = make([]string, cellLength)
	}
	for rowIndex, row := range sheet.Rows {
		//遍历每一列
		for cellIndex, cell := range row.Cells {
			text := cell.String()
			arr[rowIndex][cellIndex] = text
		}
	}
	return arr
}
