https://github.com/jimouchen/go-lst2xlsx
A efficient tool implemented by go to convert lists to excel/列表转excel的高效工具
https://github.com/jimouchen/go-lst2xlsx
go lst2xlsx tools
Last synced: 3 months ago
JSON representation
A efficient tool implemented by go to convert lists to excel/列表转excel的高效工具
- Host: GitHub
- URL: https://github.com/jimouchen/go-lst2xlsx
- Owner: JimouChen
- License: apache-2.0
- Created: 2024-11-07T13:34:22.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-07T14:52:05.000Z (7 months ago)
- Last Synced: 2025-01-27T08:15:35.363Z (4 months ago)
- Topics: go, lst2xlsx, tools
- Language: Go
- Homepage:
- Size: 3.84 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-lst2xlsx
- A efficient tool implemented by go to convert lists to excel/列表转excel的高效工具
## 使用场景
- 一个json文件(./data/lst.json),内容如下:
```json
[
{
"name": "Tom",
"age": 22,
"addr": "A City"
},
{
"name": "Peter",
"age": 42,
"addr": "B City"
},
{
"name": "Gogo",
"age": 18,
"addr": "C City"
}
]
```- 要把上述的数据转成excel,并且可以指定列名的顺序。json文件可能非常大,转换后效果如下:
## 使用例子
### 开箱即用(MacOS环境)
- 帮助说明
```bash
❯ ./lst2xlsx_mac -h
Usage of ./lst2xlsx:
-jp string
Path to the JSON file
-ord string
Column order
-s string
Sheet name (default "Sheet1")
-sp string
Path to save the Excel file (default "1730988813.xlsx")
```- 转excel
```bash
./lst2xlsx_mac -jp ./data/lst.json -sp ./data/data1.xlsx -s sheet2 -ord '["name", "addr", "age"]'
```### 自行编译后使用
#### 本地环境MacOS
```bash
go build -ldflags="-s -w" -o lst2xlsx_mac main.go
```#### Windows
```bash
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o lst2xlsx_win.exe main.go
```#### Linux
```bash
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o lst2xlsx_linux main.go
```