jexcel

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 6 Imported by: 0

README

jexcel


package main

import (
	"fmt"
	"jexcel/jexcel"
)

func main() {

	if true{

		rd := jexcel.New("testRead.xlsx")

		data, er := rd.Read()

		if er != nil {
			fmt.Println(er.Error())
			return
		}

		fmt.Println(data)
	}

	if true {
		rd := jexcel.New("testRead.csv")

		data, er := rd.Read()

		if er != nil {
			fmt.Println(er.Error())
			return
		}

		fmt.Println(data)
	}

	if true {

		rd := jexcel.New("testRead.xls")

		data, er := rd.Read()

		if er != nil {
			fmt.Println(er.Error())
			return
		}

		fmt.Println(data)
	}

	wt := jexcel.New("testWrite.xlsx")

	d := make([][]string, 100)

	for i := 0; i < 100; i++ {

		c := make([]string, 50)
		for j := 0; j < 50; j++ {
			c[j] = fmt.Sprintf("test%d-%d", i, j)
		}
		d[i] = c
	}

	err := wt.Write(d)
	if err != nil {
		fmt.Println(err.Error())
		return
	}
}


Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IExcel

type IExcel interface {
	Read() ([][]string, error)
	Write(data [][]string) error
}

func New

func New(file string) IExcel

type IExcelWriter added in v1.0.2

type IExcelWriter interface {
	SetCell(row, col int, data string) error
	SetRow(row int, data []string) error
	Save() error
}

func NewExcel added in v1.0.2

func NewExcel(file string) IExcelWriter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL