Excelize is a library written in pure Go providing a set of functions that allow you to write to and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports complex components by high compatibility, and provided streaming API for generating or reading data from a worksheet with huge amounts of data.
We are pleased to announce the release of version 2.7.0. Featured are a handful of new areas of functionality and numerous bug fixes.
Release Notes
The most notable changes in this release are:
Breaking Change
- Upgrade requirements Go language version is 1.16 or later, for migration of deprecation package
ioutil
- Checking and return error for invalid sheet name instead of trim invalid characters
- The
GetCellStyle
function no longer return master cell style of the merge cell range - Rename 5 exported data types and error constant:
- Rename
PivotTableOption
toPivotTableOptions
- Rename
FormatHeaderFooter
toHeaderFooterOptions
- Rename
FormatSheetProtection
toSheetProtectionOptions
- Rename
SparklineOption
toSparklineOptions
- Rename
ErrExistsWorksheet
toErrExistsSheet
- Rename
- Remove 54 exported types, get more details from the release page on the official documentation website
- Change 21 functions signature, get more details from the release page on the official documentation website
SetPageLayout
GetPageLayout
SetPageMargins
GetPageMargins
GetSheetIndex
SetSheetName
GetSheetVisible
DeleteSheet
NewSheet
NewConditionalStyle
NewStyle
AddChart
AddChartSheet
AddShape
AddPicture
AddPictureFromBytes
-
AddTable
and stream modeAddTable
function AutoFilter
SetPanes
SetConditionalFormat
- Introduce new function to instead of existing functions:
- Use
SetSheetProps
instead ofSetSheetPrOptions
andSetSheetFormatPr
- Use
GetSheetProps
instead ofGetSheetPrOptions
andGetSheetFormatPr
- Use
SetSheetView
instead ofSetSheetViewOptions
- Use
GetSheetView
instead ofGetSheetViewOptions
- Use
SetWorkbookProps
instead ofSetWorkbookPrOptions
- Use
GetWorkbookProps
instead ofGetWorkbookPrOptions
- Use
InsertRows
instead ofInsertRow
for support inserting multiple rows at once - Use
InsertCols
instead ofInsertCol
for support inserting multiple columns at once
- Use
- Add
CellTypeFormula
,CellTypeInlineString
,CellTypeSharedString
and removeCellTypeString
inCellType
enumeration - The parameter has been changed for the
AddComment
function, support create rich-text in comments, related issue #1204 - Remove internal error log print, an error will be returned when XML deserialize error, add error return value for the
GetComments
,GetDefaultFont
andSetDefaultFont
functions
Notable Features
- Add new functions
GetDataValidations
andGetConditionalFormats
for get data validations and conditional formats, related issue #827 - Add new functions
ProtectWorkbook
andUnprotectWorkbook
for workbook protection supports - Add new function
SetSheetCol
for set worksheet column cells, related issue #1247 - Add new function
GetColStyle
for set column styles, related issue #1293 - Add new function
SetSheetBackgroundFromBytes
for set background picture by given image data, related issue #1405 - Add new export variable
IndexedColorMapping
- Add 20 export types:
AutoFilterListOptions
,AutoFilterOptions
,Chart
,ChartAxis
,ChartDimension
,ChartLegend
,ChartLine
,ChartMarker
,ChartPlotArea
,ChartSeries
,ChartTitle
,ConditionalFormatOptions
,PaneOptions
,Panes
,GraphicOptions
,Shape
,ShapeColor
,ShapeLine
,ShapeParagraph
andTableOptions
- New support 2 formula functions: AGGREGATE and SUBTOTAL
- The
Save
,Write
andWriteTo
function now accept saving options, related issue #744 - The
AddChart
function support specify if smooth line of the line chart, related issue #1290 - The
AddChart
function support set custom line color in the charts, related issue #1345 - The
AddChart
function support custom chart axis font style, related issue #320 - The
AddChart
function support create 3D line chart - The functions
SetColWidth
,GetColWidth
,SetColVisible
,GetColVisible
,SetColStyle
andGetColStyle
now support concurrency safe - An error will be returned when set the not exist style ID, related issue #1323
- An error will be returned when setting the stream row without ascending row numbers, to avoid potential mistakes, related issue #1139
- The stream writer will be apply style in
RowOpts
for each cell, related issue #1354 - The stream writer support to set panes, related issue #1047
- The stream writer support to set inline rich text cell
- The stream writer support to insert the page break
- New 7 exported errors:
ErrUnprotectWorkbook
,ErrUnprotectWorkbookPassword
,ErrStreamSetPanes
,ErrSheetNameBlank
,ErrSheetNameInvalid
,ErrSheetNameLength
andErrSheetNameSingleQuote
has been added - Introduce 5 new export data types:
HeaderFooterOptions
,PageLayoutMarginsOptions
,PageLayoutOptions
,SheetPropsOptions
, andViewOptions
- Support to set summary columns to appear to the right of detail in an outline
- Support to set and get font color with theme and tint, related issue #1369
- Support get cell value which contains a date in the ISO 8601 format
- Support set and get font color with indexed color
- Support update column style when inserting or deleting columns
- The workbook
Close
function now support cleanup stream writer temporary files - The
AddPicture
function now allowing insert SVG format images
Improve the Compatibility
- Stream writer writes inline string type for string cell value, related issue #1377
- Skip empty rows when saving the spreadsheet to reduce file size, related issue #1383
Bug Fixes
- Fix decimal number format round issue with build-in number format, resolve issue #1328, #1368 and #1373
- Fix apply AM/PM number format issue in some case, resolve issue #1338
- Fix the panic when delete comments caused by slice bounds out of range, resolve issue #1343
- Fix the panic when get cell value in some case, resolve issue #1384 and #1415
- Fix default number format parse issue with a long string of digits, resolve issue #1360
- Fix creating a sheet with an empty name cause a corrupted file, resolve issue #1361
- Fix get image content was empty after inserting image
- Fix generate workbook corruption after insert columns/rows in some case
- Delete shared formula in calc chain when writing a formula cell, to fix generate workbook corruption in some case
- Normalize the sheet name to fix behavior regression between 2.6.0 & 2.6.1, resolve issue #1365
- Fix the formula calculation result issue of the
OR
function - Fix error on inserting columns or rows on the worksheet which contains one cell merged cell range
- Fix error on getting the range of merged cells on the worksheet which contains one cell merged cell range
- Fix getting incomplete rich text cell value in some cases
- Escape XML characters for stream writer to avoid with corrupt file, resolve issue #1391
- Fix formula function ADDRESS result error with empty worksheet name, resolve issue #1396
- Fix insert picture problem in some cases, resolve issue #1404
Performance
- Improve performance for stream writer merging cells, time cost decrease over 90% and reduce memory usage by about 86% at most
- Improving performance for stream writer
SetRow
function, reduces memory usage over and speedup about 19%
Miscellaneous
- The dependencies module has been updated
- Unit tests and godoc updated
- Using the specialized name in variables and functions
- Documentation website with multilingual: Arabic, German, Spanish, English, French, Russian, Chinese, Japanese, and Korean, which has been updated
Thank you
Thanks for all the contributors to Excelize. Below is a list of contributors that have code contributions in this version:
- cdenicola (Cooper de Nicola)
- chenliu1993
- davidborry
- patsak (Kostya Privezentsev)
- dafengge0913
- Beeb0p (Artem Tarasenko)
- invzhi
- zhangzitao (Zitao)
- jtwatson (Joseph Watson)
- carbin-gun (charles.deng)
- harrison3000 (Harrison)
- strivek (GaoFei)
- gonghaibinx
- martinmr (Martin Martinez Rivera)
- zclark (Zach Clark)
- March0715 (March)
- renxiaotu
- devloppper
- jianxinhou
- nesstord
- Bayzet (Bayzet Tlyupov)
- guoweikuang (郭伟匡)
- qinyuguang (Gin)
- liron-l (Liron Levin)