此包以cgo的方式调用c的libxls库,用于解析xls和xlsx文件,以及封装方法将文件内容转成csv格式的字符串
-
xls2csv requires libxls to be installed.
-
Install libxls
wget http://downloads.sourceforge.net/libxls/libxls-0.2.0.tar.gz tar -xzvf libxls-0.2.0.tar.gz cd libxls-0.2.0 ./configure make sudo make install
-
Add libxls lib path to
LD_LIBRARY_PATH
(mac环境下不需要)-
Create a new
/etc/ld.so.conf.d/libxls.conf
sudo vi /etc/ld.so.conf.d/libxls.conf // Add path of libxls to this file /usr/local/libxls/lib
-
Update
LD_LIBRARY_PATH
sudo ldconfig // Check libxlsreader.so sudo ldconfig -p | grep libxls
-
-
-
Do not forget to add
CGO_CFLAGS=-I/usr/local/libxls/include CGO_LDFLAGS="-L/usr/local/libxls/lib -l xlsreader"
beforego build
orgo test
go build