Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rosbit/xlsx-extractor
xlsx/csv columns extractor. xlsx/csv列提取器,免去数数字的烦恼
https://github.com/rosbit/xlsx-extractor
Last synced: about 6 hours ago
JSON representation
xlsx/csv columns extractor. xlsx/csv列提取器,免去数数字的烦恼
- Host: GitHub
- URL: https://github.com/rosbit/xlsx-extractor
- Owner: rosbit
- License: mit
- Created: 2021-02-10T08:45:05.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-29T08:38:57.000Z (about 1 year ago)
- Last Synced: 2024-06-21T06:28:25.274Z (5 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xlsx/csv列提取器
1. 根据指定标题列表提取列字段
1. 标题行前可以有空行
1. 正确转化日期## 使用方法
```go
import (
"github.com/rosbit/xlsx-extractor"
"os"
"fmt"
)func main() {
// --- reading xlsx book sheet ----
book, err := os.Open("somebook.xlsx")
if err != nil {
// error
return
}
defer book.Close()rows, err := xlsx.XlsxRows(book, "Sheet1", []string{"title1", "title2", "title3"})
if err != nil {
// error
}
for row := range rows {
fmt.Printf("%#v\n", row)
}// --- reading csv ----
fpCsv, err := os.Open("somename.csv")
if err != nil {
// error
}
defer fpCsv.Close()
lines, err := xlsx.CsvRows(fpCsv, []string{"title1", "title2"})
if err != nil {
// error
}
for line := range lines {
fmt.Printf("%#v\n", line)
}
}```