read_excel

command module
v0.0.0-...-0cf9e5f Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: MIT Imports: 7 Imported by: 0

README

php项目需要读取上传的xls/xlsx文件入库,所以开发了这个脚本

$cmd = "./read_excel  --file=xxx.xls";
$xlsx = `$cmd`;
if (strstr($xlsx, 'not a valid zip file') || strstr($xlsx, 'not an excel file')) {
    return ['error' => '请另存为xlsx或xls文件再上传'];
}
$xlsx = json_decode(str_replace('result =  ', '', $xlsx), 1);

mac上打包linux运行文件
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o read_excel main.go

Documentation

Overview

* 读取excel

Jump to

Keyboard shortcuts

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