Go to file
2024-10-17 20:58:06 +02:00
example feat: 🎉 nace gorender 2024-08-21 22:39:00 +02:00
gorender solving conflicts 2024-10-17 20:58:06 +02:00
testutils initial commit 2024-10-17 20:51:31 +02:00
.gitignore solving conflicts 2024-10-17 20:58:06 +02:00
Book1.xlsx feat: 🎉 first commit 2023-03-19 21:14:24 +01:00
exceltostruct.go fix: remove limitations 2023-03-20 05:16:32 +01:00
go.mod file organization 2024-10-17 20:56:10 +02:00
go.sum file organization 2024-10-17 20:56:10 +02:00
README.md file organization 2024-10-17 20:56:10 +02:00

excel2struct

Convierte una hoja de excel compatible con la librería Excelize a un tipo estructurado de Go. La primera fila debe coincidir con la etiqueta XLSX, sensible a las mayúsculas.

Id Nombre Apellidos Email Género Balance
1 Caryl Kimbrough ckimbrough0@fotki.com true 571.08
2 Robin Bozward rbozward1@thetimes.co.uk true 2162.89
3 Tabbie Kaygill tkaygill2@is.gd false 703.94
type User struct {
	Id       int     `xlsx:"Id"`
	Name     string  `xlsx:"Nombre"`
	LastName string  `xlsx:"Apellidos"`
	Email    string  `xlsx:"Email"`
	Gender   bool    `xlsx:"Género"`
	Balance  float32 `xlsx:"Balance"`
}
func main() {
 data := exceltostruct.Convert[User]("Book1.xlsx", "Sheet1")
 fmt.Println(data)
}
[{1 Caryl Kimbrough ckimbrough0@fotki.com true 571.08} {2 Robin Bozward rbozward1@thetimes.co.uk true 2162.89} {3 Tabbie Kaygill tkaygill2@is.gd false 703.94}]

Donde el primer parámetro es la ruta donde está ubicada la hoja de cálculo y la segunda el nombre de la hoja.

Tipos compatibles: int, float32, bool y string.