Go Excelize Logo

Excelize

Introduction

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. This library needs Go version 1.15 or later. The full API docs can be seen using go's built-in documentation tool, or online at go.dev and docs reference.

Basic Usage

Installation

go get github.com/xuri/excelize
  • If your packages are managed using Go Modules, please install with following command.
go get github.com/xuri/excelize/v2

Create spreadsheet

Here is a minimal example usage that will create spreadsheet file.

package main

import (
    "fmt"

    "github.com/xuri/excelize/v2"
)

func main() {
    f := excelize.NewFile()
    // Create a new sheet.
    index := f.NewSheet("Sheet2")
    // Set value of a cell.
    f.SetCellValue("Sheet2", "A2", "Hello world.")
    f.SetCellValue("Sheet1", "B2", 100)
    // Set active sheet of the workbook.
    f.SetActiveSheet(index)
    // Save spreadsheet by the given path.
    if err := f.SaveAs("Book1.xlsx"); err != nil {
        fmt.Println(err)
    }
}

Reading spreadsheet

The following constitutes the bare to read a spreadsheet document.

package main

import (
    "fmt"

    "github.com/xuri/excelize/v2"
)

func main() {
    f, err := excelize.OpenFile("Book1.xlsx")
    if err != nil {
        fmt.Println(err)
        return
    }
    defer func() {
        // Close the spreadsheet.
        if err := f.Close(); err != nil {
            fmt.Println(err)
        }
    }()
    // Get value from cell by given worksheet name and axis.
    cell, err := f.GetCellValue("Sheet1", "B2")
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println(cell)
    // Get all the rows in the Sheet1.
    rows, err := f.GetRows("Sheet1")
    if err != nil {
        fmt.Println(err)
        return
    }
    for _, row := range rows {
        for _, colCell := range row {
            fmt.Print(colCell, "\t")
        }
        fmt.Println()
    }
}

Add chart to spreadsheet file

With Excelize chart generation and management is as easy as a few lines of code. You can build charts based on data in your worksheet or generate charts without any data in your worksheet at all.

Excelize

package main

import (
    "fmt"

    "github.com/xuri/excelize/v2"
)

func main() {
    categories := map[string]string{
        "A2": "Small", "A3": "Normal", "A4": "Large",
        "B1": "Apple", "C1": "Orange", "D1": "Pear"}
    values := map[string]int{
        "B2": 2, "C2": 3, "D2": 3, "B3": 5, "C3": 2, "D3": 4, "B4": 6, "C4": 7, "D4": 8}
    f := excelize.NewFile()
    for k, v := range categories {
        f.SetCellValue("Sheet1", k, v)
    }
    for k, v := range values {
        f.SetCellValue("Sheet1", k, v)
    }
    if err := f.AddChart("Sheet1", "E1", `{
        "type": "col3DClustered",
        "series": [
        {
            "name": "Sheet1!$A$2",
            "categories": "Sheet1!$B$1:$D$1",
            "values": "Sheet1!$B$2:$D$2"
        },
        {
            "name": "Sheet1!$A$3",
            "categories": "Sheet1!$B$1:$D$1",
            "values": "Sheet1!$B$3:$D$3"
        },
        {
            "name": "Sheet1!$A$4",
            "categories": "Sheet1!$B$1:$D$1",
            "values": "Sheet1!$B$4:$D$4"
        }],
        "title":
        {
            "name": "Fruit 3D Clustered Column Chart"
        }
    }`); err != nil {
        fmt.Println(err)
        return
    }
    // Save spreadsheet by the given path.
    if err := f.SaveAs("Book1.xlsx"); err != nil {
        fmt.Println(err)
    }
}

Add picture to spreadsheet file

package main

import (
    "fmt"
    _ "image/gif"
    _ "image/jpeg"
    _ "image/png"

    "github.com/xuri/excelize/v2"
)

func main() {
    f, err := excelize.OpenFile("Book1.xlsx")
    if err != nil {
        fmt.Println(err)
        return
    }
    defer func() {
        // Close the spreadsheet.
        if err := f.Close(); err != nil {
            fmt.Println(err)
        }
    }()
    // Insert a picture.
    if err := f.AddPicture("Sheet1", "A2", "image.png", ""); err != nil {
        fmt.Println(err)
    }
    // Insert a picture to worksheet with scaling.
    if err := f.AddPicture("Sheet1", "D2", "image.jpg",
        `{"x_scale": 0.5, "y_scale": 0.5}`); err != nil {
        fmt.Println(err)
    }
    // Insert a picture offset in the cell with printing support.
    if err := f.AddPicture("Sheet1", "H2", "image.gif", `{
        "x_offset": 15,
        "y_offset": 10,
        "print_obj": true,
        "lock_aspect_ratio": false,
        "locked": false
    }`); err != nil {
        fmt.Println(err)
    }
    // Save the spreadsheet with the origin path.
    if err = f.Save(); err != nil {
        fmt.Println(err)
    }
}

Built With

Share this project:

Updates

posted an update

We are pleased to announce the release of version 2.10.1. Featured are a handful of new areas of functionality and numerous bug fixes.

A summary of changes is available in the Release Notes. A full list of changes is available in the changelog.

Release Notes

The most notable changes in this release are:

Breaking Change

Removed three exported error variables: ErrStreamSetColStyle, ErrStreamSetColWidth, and ErrStreamSetPanes.

Notable Features

  • Added the ChartDataPoint data type
  • Added the DataPoint field to ChartSeries
  • Added the DropLines and HighLowLines fields to ChartAxis
  • Added the Name field to GraphicOptions
  • Added two constants: MaxGraphicAltTextLength and MaxGraphicNameLength
  • Added 7 exported error variables: ErrFillType, ErrFillGradientColor, ErrFillGradientShading, ErrFillPatternColor, ErrFillPattern, ErrMaxGraphicAltTextLength and ErrMaxGraphicNameLength
  • Added the exported function GetHyperLinkCells to retrieve hyperlink cells, related issue 1607
  • Added the exported function GetSheetProtection to retrieve sheet protection settings
  • The AddComment function now returns an error when adding a comment to a cell that already has one
  • Added support for inserting ICO images, related issue 2234
  • The CalcCellValue function now supports two formula functions: SORTBY and UNIQUE
  • The AddChart and AddChartSheet functions now support setting data point colors for doughnut, pie, and 3D pie charts, related issue 1904
  • The AddChart function now supports configuring font families for East Asian and complex-script fonts
  • The AddChart function now supports drop lines and high-low lines for area and line charts
  • The GetPictures function can now return partial formatting properties, related issue 2157
  • Added the SetColVisible function to the streaming writer to set column visibility, related issue 2075
  • Added the SetColOutlineLevel function to the streaming writer to group columns, related issue 2212
  • The AddShape and AddSlicer functions now support one-cell anchor positioning for shapes and slicers
  • The GetSlicers function now supports retrieving slicers with one-cell anchor positioning
  • The SetConditionalFormat, GetConditionalFormats, and UnsetConditionalFormat functions now support the 3 triangles, 3 stars, and 5 boxes icon set conditional formats, related issue 2038
  • The UnsetConditionalFormat function now supports deleting a conditional format rule or data validation for a specific cell within a cell range
  • The AddPicture and AddPictureFromBytes functions now support setting the picture name
  • The AddChart and AddShape functions now support setting names and alternative text for charts and shapes
  • The AddSlicer function now supports setting alternative text for slicers
  • Added validation for graphic names and alternative text length; returns an error when the length exceeds the limit
  • Added UTF-16-aware length checking and truncation

Improve the Compatibility

  • Removed empty rows on save, reducing the generated workbook file size

Bug Fixes

  • Fixed a v2.10.0 regression where the GetCellValue and GetRows functions returned shared string indexes for empty strings, resolve issue 2240
  • Fixed GetPivotTables panicking when retrieving pivot tables in some cases
  • Fixed a panic when reading cell values with certain number format codes containing Chinese month names, resolve issue 2224
  • Fixed a panic when opening encrypted workbooks in some cases, resolve issue 2237
  • Fixed missing column styles when using the streaming writer SetRow function
  • Fixed GetPictures not returning some cell images
  • Fixed workbook corruption caused by light theme color index overflow
  • Fixed DeleteDataValidation updating data validation cell ranges incorrectly with unordered cell references
  • Fixed SetConditionalFormat generating corrupted workbooks when setting time period conditional formatting rules
  • Fixed CalcCellValue failing to resolve references in some cases by trimming single quotes from sheet names
  • Fixed NewStyle creating duplicate styles when using the default font or fill, resolve issue 2254

Performance

  • Optimized CalcCellValue by adding a calculation cache and limiting processing to actual data ranges, resolve issues 2057 and 2223
  • Optimized CalcCellValue formula evaluation for VLOOKUP, reducing memory usage and execution time by about 50%, resolve issue 2139
  • Optimized GetMergeCells by speeding up overlap checks for merged cell ranges and reducing memory usage, resolve issue 2226
  • Optimized applying number format codes by converting using continued-fraction recurrence formulas

Miscellaneous

  • The dependencies module has been updated
  • Unit tests and godoc updated
  • Documentation website with multilingual: Arabic, German, English, Spanish, French, Italian, Japanese, Korean, Portuguese, Russian, Chinese Simplified and Chinese Traditional, which has been updated.
  • excelize-wasm NPM package release update for WebAssembly / JavaScript support
  • excelize PyPI package release update for Python
  • ExcelizeCs NuGet .Net package release for C#

Thank you

Thanks for all the contributors to Excelize. Below is a list of contributors that have code contributions in this version:

  • pjh591029530 (Simmons25)
  • Sang-Hyuk (SangHyuk)
  • wangacc
  • kenny-not-dead (Roman Sergeev)
  • pegasscience-cyber
  • jesusfelix951-lang
  • felixdevelopper-hue
  • shcabin
  • radam9
  • sqdtss
  • IvanHristov98 (Ivan Hristov)
  • yasarluo (Yasar Luo)
  • DengY11 (Yi Deng)
  • Kingson4Wu (Kingson4Wu)
  • zhuzhengyang (Zhu Zhengyang)
  • schbook
  • rhinewg
  • jpoz (James Pozdena)
  • sides-flow (Sides)
  • t4traw (Tatsuro Moriyama)
  • ijustyce (杨春)
  • d9c4
  • imirkin (Ilia Mirkin)
  • atmngw (Atsuki)
  • Flashcqxg
  • olivere (Oliver Eilhard)
  • susautw (Su, Rin)
  • ohauer (Olli Hauer)
  • yan00353-0729

Log in or sign up for Devpost to join the conversation.

posted an update

We are pleased to announce the release of version 2.10.0. Featured are a handful of new areas of functionality and numerous bug fixes.

A summary of changes is available in the Release Notes.

Release Notes

The most notable changes in this release are:

Breaking Change

  • Upgrade requirements Go language version is 1.24.0 or later, for upgrade of dependency package golang.org/x/crypto

Notable Features

  • Add new exported error variable ErrTransparency
  • Add new ChartDashType, CustomProperty and ZipWriter data types
  • Add new field Border to the ChartMarker data type
  • Add new field Font to the ChartLegend data type
  • Add new field Legend to the ChartSeries data type
  • Add new field Transparency to the Fill data type
  • Add new fields Dash and Fill to the ChartLine data type
  • Add new field TmpDir to the Options data type, support to specifies the custom temporary directory for creating temporary files, related issue 2024
  • Add new field Charset to the Font data type, support to explicitly specify font encodings when generating spreadsheets
  • Add new functions GetCustomProps and SetCustomProps support getting and setting workbook custom properties, related issue 2146
  • Add new function SetZipWriter, support set custom ZIP writer, related issue 2199
  • Add optional parameter withoutValues for the GetMergeCells function
  • The DeleteDataValidation function support delete data validation in extension list, and support delete data validation by given with multiple cell ranges with reference sequence slice or blank separated reference sequence string, related issue 2133
  • The AddChart function support set dash line and marker border type of charts
  • The AddChart function support to set font for chart legends, related issue 2169
  • The AddChart and AddChartSheet function support create 4 kinds of box and whisker stock charts: High-Low-Close, Open-High-Low-Close, Volume-High-Low-Close and Volume-Open-High-Low-Close
  • The CalcCellValue function support BAHTTEXT formula function
  • Skip fallback to default font size when create style if font size less than minimum size
  • Support parse number format code with Hijri and Gregorian calendar
  • Support set transparency for chart and shape, related issue 2176
  • Support apply number format with the new 8 language: Corsican, Croatian, Croatian (Latin), Czech, Danish, Divehi, Dutch, Dzongkha language

Improve the Compatibility

  • Remove all leading equal symbol when set cell formula, for improve compatibility with Apple Numbers, related issue 2145
  • Using relative sheet target path in the internal workbook relationship parts

Bug Fixes

  • Fix a v2.9.1 regression bug, build failed on ARMv7 architectures, resolve issue 2132
  • Fix number format parser dropped empty literals in the end of the number format
  • Fix panic on get string item with invalid offset range, resolve issues 2019 and 2150
  • Fix panic on read unsupported pivot table cache sorce types, resolve issue 2161
  • Fix incorrect characters verification, count characters as single runes in characters length limitation checking, resolve issue 2167
  • Fix add pivot table caused workbook corrupted on Excel for Mac, resolve issue 2180
  • Fix incorrect month name abbreviations when read cell with the Tibetan language number format code
  • Fix special date number format result not consistent with Excel, resolve issue 2192

Performance

  • Optimize the GetSheetDimension function by parse worksheet XML in stream mode, speedup about 95%, memory usage reduce about 96%

Miscellaneous

  • The dependencies module has been updated
  • Unit tests and godoc updated
  • Documentation website with multilingual: Arabic, German, English, Spanish, French, Italian, Japanese, Korean, Portuguese, Russian, Chinese Simplified and Chinese Traditional, which has been updated.
  • excelize-wasm NPM package release update for WebAssembly / JavaScript support
  • excelize PyPI package release update for Python
  • ExcelizeCs NuGet .Net package release for C#
  • Add a new logo for Excelize

Thank you

Thanks for all the contributors to Excelize. Below is a list of contributors that have code contributions in this version:

  • DengY11 (Yi Deng)
  • JerryLuo-2005
  • aliavd1 (Ali Vatandoost)
  • xiaoq898
  • Now-Shimmer
  • Jameshu0513
  • mengpromax (MengZhongYuan)
  • Leopard31415926
  • hongjr03 (Hong Jiarong)
  • juefeng
  • black-butler
  • Neugls
  • Leo012345678
  • a2659802
  • torotake
  • crush-wu
  • zhuyanhuazhuyanhua
  • shcabin

Log in or sign up for Devpost to join the conversation.

posted an update

We are pleased to announce the release of version 2.9.1. Featured are a handful of new areas of functionality and numerous bug fixes.

A summary of changes is available in the Release Notes. A full list of changes is available in the changelog.

Release Notes

The most notable changes in this release are:

Breaking Change

  • Upgrade requirements Go language version is 1.23 or later, for upgrade of dependency package golang.org/x/crypto
  • Change the data type of DataValidationType, DataValidationErrorStyle, DataValidationOperator, PictureInsertType from int to byte
  • SetCellInt function required int64 data type parameter, resolve issue 2068
  • When adding drawing objects such as pictures, charts, shapes, and form controls, the offset setting will no longer affect the size of the drawing object, related issue 2001

Notable Features

  • Add new fields GapWidth and Overlap in the Chart data type
  • Add new fields ShowDataTable and ShowDataTableKeys fields in the ChartPlotArea data type
  • Add new field Alignment in the ChartAxis data type
  • Add new field DataLabel in the ChartSeries data type
  • Add new field PageOrder for PageLayoutOptions data type
  • Add 2 new exported error variables: ErrPageSetupAdjustTo and ErrStreamSetColStyle
  • Add 2 new exported enumerations: HeaderFooterImagePositionType and IgnoredErrorsType
  • Add 2 new exported data types: CalcPropsOptions and HeaderFooterImageOptions
  • Add 2 new functions: SetCalcProps and GetCalcProps support setting and getting workbook calculation properties
  • Add new CultureNameJaJP, CultureNameKoKR and CultureNameZhTW enumeration values, support apply number format for the Japanese calendar years, the Korean Danki calendar and the Republic of China year, related issue 1885
  • Add new function AddHeaderFooterImage to support set graphics in a header and footer, related issue 1395
  • Add new function AddIgnoredErrors support to ignored error for a range of cells, related issue 2046
  • Add new function SetColStyle for streaming writer to support set columns style, related issue 2075
  • The AddChart and AddChartSheet function support set chart axis text direction and rotation, related issue 2025
  • The AddChart and AddChartSheet function support set gap width and overlap for column and bar chart, related issue 2033
  • The AddChart and AddChartSheet function support set the format of the chart series data label, related issue 2052
  • The AddChart and AddChartSheet function support set data table for chart, related issue 2117
  • The AddFormControl function support set cell link for check box, related issue 2113
  • The SetPageLayout function support set page order of page layout
  • The DeletePicture function support delete one cell anchor image, related issue 2059
  • An error will be return if the option value of the SetPageLayout function is invalid
  • Support adjust data validations cross multiple worksheets, related issue 2072
  • Support apply number format with hash and zero place holder, related issue 2058
  • Support apply number format with ? symbol
  • Support to insert one cell anchor drawing object when specified the positioning as "oneCell", related issue 2002

Bug Fixes

  • Fix a v2.9.0 regression bug, corrupted workbook generated by open the workbook generated by stream writer, resolve issue 2015
  • Fix redundant none type pattern fill generated, resolve issue 2014
  • Fix missing vertical and horizontal border styles in some case, resolve issue 2048
  • Fix conditional format's border styles missing in some case, resolve issue 2061
  • Fix get pivot tables panic in some case, resolve issues 1954 and 2051
  • Fix GetStyle function can not get VertAlign format
  • Fix CalcCellValue function subexpressions aren't correctly calculated in some case, resolve issue 2083
  • Fix delete wrong images in some case which caused by image reference detection issue
  • Fix cell default style doesn't override by none-zero row style when set row by stream writer
  • Fix redundant cols element generated by stream writer
  • Fix panic on set chart title font, resolve issue 2102
  • Fix panic on delete calc chain in some case
  • Fix incorrect formula calculation result caused by shared formula parse error, resolve issue 2056
  • Fix corrupted workbook generated when an inner ZIP64 file size exceeds 4GB
  • Fix sheet name error in defined name after rename sheet, resolve issue 2126

Performance

  • Use a 3 times faster deepcopy library github.com/tiendc/go-deepcopy instead of github.com/mohae/deepcopy, related issue 2029
  • Fix performance regression in v2.9.0, reduce trim cell value memory allocation for blank cells
  • Improve performance for calculate formula when formula contains whole column and row reference
  • Rows iterator speedup about 20%, memory allocation reduce about 10%

Miscellaneous

  • The dependencies module has been updated
  • Unit tests and godoc updated
  • Documentation website with multilingual: Arabic, German, English, Spanish, French, Italian, Japanese, Korean, Portuguese, Russian, Chinese Simplified and Chinese Traditional, which has been updated.
  • excelize-wasm NPM package release update for WebAssembly / JavaScript support
  • excelize PyPI package release update for Python

Thank you

Thanks for all the contributors to Excelize. Below is a list of contributors that have code contributions in this version:

  • wushiling50
  • imirkin (Ilia Mirkin)
  • Juneezee (Eng Zer Jun)
  • Arpelicy
  • zhuhaicity (ZhuHaiCheng)
  • xxf0512 (xxf)
  • gypsy1234
  • mengpromax (MengZhongYuan)
  • hly-717
  • kurtinge (Kurt Inge Smådal)
  • IvanHristov98 (Ivan Hristov)
  • artur-chopikian (Artur Chopikian)
  • romanshevelev (Roman Shevelev)
  • LZCZ
  • hm3248
  • moisespsena (Moises P. Sena)
  • paolobarbolini (Paolo Barbolini)
  • timesince
  • shcabin
  • tgulacsi (Tamás Gulácsi)
  • R3dByt3 (R3dByt3)
  • Now-Shimmer

Log in or sign up for Devpost to join the conversation.

posted an update

We are pleased to announce the release of version 2.9.0. Featured are a handful of new areas of functionality and numerous bug fixes.

A summary of changes is available in the Release Notes. A full list of changes is available in the changelog.

Release Notes


The most notable changes in this release are:

Breaking Change

  • Change the data type for the ConditionalFormatOptions structure field Format as a pointer, resolve issue #1867

Notable Features

  • Add new functions DeleteSlicer and GetSlicers, related issue #810
  • Add new function MoveSheet to support changing sheet order in the workbook, related issue #1076
  • Add new AutoFitIgnoreAspect field in the GraphicOptions data type support for fill the cell with the image and ignore its aspect ratio
  • Add new TickLabelPosition field in the ChartAxis data type support for set label position of the chart
  • Add new fields ShowAll, InsertBlankRow and NumFmt field in the PivotTableField data type
  • Add new fields ClassicLayout, FieldPrintTitles and ItemPrintTitles in the PivotTableOptions data type
  • Introduce 2 new exported enumeration type ChartTickLabelPositionType and PictureInsertType
  • Introduce new exported ChartLineUnset enumeration value
  • Introduce 4 constants ExtURIDataField, ExtURIPivotField, ExtURIPivotFilter and ExtURIPivotHierarchy
  • Introduce new exported error variable ErrPivotTableClassicLayout
  • The MergeCell function support clear slave cells value when merging cells
  • The AddDataValidation, DeleteDataValidation and GetCellStyle functions support concurrency safe, related issues #1825
  • The GetDataValidations function support get data validations which storage in the extension lists, related issue #1835
  • The SetSheetName function support case sensitivity, related issue #1856
  • The GetPictureCells and GetPictures functions support for get the cell images inserted by IMAGE formula function and absolute paths for pictures
  • The SetCellHyperLink function support remove hyperlink by None linkType, related issue #1940
  • The AddChart function support create combo chart with same types, related issue #1940
  • The AddChart function support set line type of scatter chart
  • An error will be return if column header cell is empty in pivot table data range when create pivot table by AddPivotTable function, related issue #1945
  • Add support for applying number format expression with language/location tags and ID
  • Add support for apply number format for time and duration cell value, related issue #2004
  • New support formula function: DOLLAR

Improve the Compatibility

  • Improve compatibility for apply number format, support apply number format with alignment, resolve issue #1847
  • Improvement compatibility for the workbook internal part with a spreadsheet namespace prefix, resolve issue #1886
  • Improve compatibility for the workbook internal media files with absolute path, resolve issue #1888

Bug Fixes

  • Fix a v2.8.1 regression bug, auto filter doesn't work in the LibreOffice, resolve issue #1830
  • Fix a v2.8.1 regression bug, support to adjust data validation with multiple cell range, resolve issue #1831
  • Fix a v2.8.1 regression bug, error on duplicate rows, if conditional formatting or data validation has multiple cell range reference
  • Fix a v2.8.1 regression bug, incorrect cell value written if save multiple times, resolve issue #1906
  • Fix a v2.8.1 regression bug, spark lines duplicate when creating spark lines on multiple sheets, resolve issue #1910
  • The CalcCellValue function support calculate formula functions ISNUMBER, OR and FIND with matrix arguments, resolve issue #1819
  • Fix the CalcCellValue function calculation result round issue, resolve issue #1851
  • Fix the CalcCellValue function returns incorrect result of formula functions XIRR and XNPV, resolve issue #1989
  • Fix the RemoveCol returns error when deleting columns, resolve issue #1829
  • Fix incorrect result data type of the DATE formula function, resolve issue #1833
  • Fix panic on read workbook with internal row element without r attribute
  • Fix parentheses in formulas get cut out when inserting new columns or rows, resolve issue #1861
  • Fix incorrect data validation escape result in some cases
  • Fix some character can't be displayed in stream writer, resolve issue #1865
  • Saving workbook with sorted internal part path to keep same hash of identical files and fix incorrect MIME type, resolve issue #1889
  • Fix the AddChart function set axis format doesn't work in combo chart, resolve issue #1921
  • Fix the AddChart function set incorrect primary axis titles position
  • Fix the AddChart function set secondary vertical axis title is not displayed, resolve issue #1926
  • Fix the AddChart function set line type of line chart does not work
  • Fix the GetPivotTables function returns incorrect data range, resolve issue #1937
  • Fix the GetStyle function panic when theme without sysClr, resolve issue #1963
  • Fix the GetCellRichText function returns error when read cell without SST index, resolve issue #1999
  • Fix the SetSheetVisible function panic on none views sheet, resolve issue #1969
  • Fix percent sign missing in formatted result for zero numeric cell value, resolve issue #1942
  • Fix missing horizontal axis in scatter chart with negative values
  • Fix missing shape macro missing after adjusted drawing object, resolve issue #1957
  • Fix missing conditional formatting after remove column in some cases, resolve issue #1968
  • Fix read cell value with decimal value round issue, resolve issue #1979
  • Support to set cell value with an IEEE 754 "not-a-number" value or infinity, resolve issue #119

Performance

  • Fix v2.8.0 regression speed slowdown and memory usage increase issue
  • Reduce memory usage for the GetRows function, related issue #1874
  • Optimize ColumnNumberToName function performance, reduce about 50% memory usage and 50% time cost

Miscellaneous

  • The dependencies module has been updated
  • Unit tests and godoc updated
  • Documentation website with multilingual: Arabic, German, English, Spanish, French, Japanese, Korean, Portuguese, Russian, Chinese Simplified and Chinese Traditional, which has been updated. Added Italian version of the document

Thank you

Thanks for all the contributors to Excelize. Below is a list of contributors that have code contributions in this version:

  • mirgong (helloWorld)
  • YueChenXu-Kimi (岳晨旭)
  • JackMin1314 (陈王)
  • paolobarbolini (Paolo Barbolini)
  • iEvan-lhr (Evan lu)
  • yetyear (yeahyear)
  • ha5ky (hu5ky)
  • lizhichao (vic)
  • realzuojianxiang (realzuojianxiang)
  • msackman (Matthew Sackman)
  • yyle88 (yangyile-yyle88)
  • yunkeweb (yunkeweb)
  • iraj720 (Nima)
  • jianxinhou
  • barlevd
  • 18409615759 (nna)
  • qijinkui (xiaokui)
  • user1121114685 (联盟少侠)
  • wangsongyan
  • vsemichev (Vovka Morkovka)
  • zhayt (Aybek)
  • ShowerBandV (ShowerBandV)
  • imink (Patrick Wang)
  • samkeke (wxy)
  • pjh591029530
  • zhangyimingdatiancai
  • wanghaochen2024
  • centurion-hub
  • peng (Zhang Zhipeng)
  • slashdotdash (Ben Smith)
  • ArcholSevier
  • liuwangchao
  • Zncl2222 (Jian Yu, Chen)

Log in or sign up for Devpost to join the conversation.

posted an update

We are pleased to announce the release of version 2.8.1. Featured are a handful of new areas of functionality and numerous bug fixes.

A summary of changes is available in the Release Notes. A full list of changes is available in the changelog.

Release Notes

The most notable changes in this release are:

Breaking Change

  • Upgrade requirements Go language version is 1.18 or later, for upgrade of dependency package golang.org/x/net
  • Change the data type for the HeaderFooterOptions structure fields AlignWithMargins and ScaleWithDoc as a pointer, resolve issue #1645
  • Remove unused exported data structure ShapeColor

Notable Features

  • Add new exported function SetCellUint, related issue #1681
  • Add new exported function GetPictureCells for get all picture cells, related issue #1218
  • Add new exported function GetConditionalStyle for get the conditional format style definition, related issue #1690
  • Add new exported function GetHeaderFooter for get the worksheet header and footer
  • Add new exported function AddSlicer for adding table and pivot table slicers
  • Add new exported function GetPivotTables for get pivot tables
  • Add new exported function DeletePivotTable for delete pivot table
  • Add a new Name field in the PivotTableOptions to support specify pivot table name
  • New support 7 formula functions: DBCS, SEARCH, SEARCHB, TEXT, TEXTAFTER, TEXTBEFORE and xlfn.ANCHORARRAY
  • Add export ChartLineType enumeration to specify the chart line type, related issue #1706
  • Add new Border field in the Chart data type to set the chart area border
  • Add new Type field in the ChartLine type to set the line type
  • Add new exported source relationship and namespace NameSpaceSpreadSheetXR10, ContentTypeSlicer, ContentTypeSlicerCache, and SourceRelationshipSlicer
  • Add new exported extended URI ExtURIPivotCacheDefinition
  • Allow dot character in the defined name, table name, or pivot table name
  • Keep all cells value in the table range when deleting table
  • Support format cell value with fraction number format code
  • Support delete image files from the workbook internally when deleting pictures to reduce generated workbook size and resolve potential security issues
  • Support set the height and width for the comment box, related issue #1688
  • Support update conditional formatting, data validations, defined names, drawing objects, formula reference and volatile dependencies on inserting/deleting columns/rows, related issues #1306 and #1615
  • Support 6 new kinds of conditional formatting types: text, blanks, no blanks, errors, no errors and time period
  • Support calculate formula with multiple dash arithmetic symbol
  • Support copy conditional format and data validation on duplicate row, related issue #1729
  • Support unset custom row height if the height value is -1 when using the SetRowHeight function
  • The SetRowHeight function will return an error if given an invalid row height value
  • The AddChart function support set the data labels position for the chart, related issue #1704
  • The AddChart function support set solid color or transparent fill for chart area, plot area, and maker, add a new field Fill in Chart, ChartPlotArea, and ChartMarker data type, related issue #1786
  • The AddChart function support set chart axis font family, size and strike style, related issue #1809
  • Add new field DataLabelPosition in the ChartSeries data type, support to sets the position of the chart series data label
  • Add new field BubbleSize in the Chart data type, support set the bubble size in all data series for the bubble chart or 3D bubble chart
  • Add new exported ChartDataLabelPositionType data type
  • The GetPictureCells and GetPictures function support get embedded cell images created by Kingsoft WPS™ Office, related issue #664
  • The SetConditionalFormat function support set conditional formatting with multiple cell ranges, related issue #1783
  • Support to update defined names reference when rename worksheet, related issue #1792
  • Add new GetBaseColor function support get the preferred hex color code, related issue #1794
  • The calculation engine support date and formula type cells, related issue #1807
  • Cell value reading functions inherit the Options settings of the OpenReader, related issue #1815

Improve the Compatibility

  • Improve compatibility for absolute path drawing part
  • Improve compatibility for workbook internal tab ratio property value
  • Improve compatibility with empty custom number format code
  • Improve compatibility with the viewer which doesn't support default theme part namespace, related issue #1694
  • Improve delete cell comment shape compatibility with KingSoft WPS™ Office, related issue #1789
  • Saving workbook with sorted internal part path, make identically created workbooks hash checksum is same, related issue #1732

Bug Fixes

  • Add check for MID and MIDB formula functions num_chars arguments, prevent panic on specifying a negative number, resolve issue #1647
  • Fix empty calculate result with numeric arguments in LEN, LOWER, PROPER, REPT, UPPER, and IF formula functions
  • Fix calculate formula functions CHITEST and MMULT panic in some cases
  • Fix a v2.8.0 regression bug, error on set print area and print titles with built-in special defined name
  • Fix a v2.8.0 regression bug, corrupted workbooks generated by improving compatibility with internally indexed color and MRU colors styles parts
  • Fix a v2.8.0 regression bug, number format code apply result was empty, resolve issue #1658
  • Fix a v2.7.1 regression bug, the bubble is hidden in the bubble or 3D bubble chart
  • Fixed panic on AutoFilter by adding nil pointer guard for local sheet ID, resolve issue #1655
  • Fix corrupted workbooks generated when adding tables in some cases
  • Fix incorrect time number format result, resolve issue #1661
  • Supports getting formula string cell value, resolve issue #1665
  • Fix incorrect table ID generated in the workbook which contains single table cells
  • Fix missing relationship parts in the content types in some cases
  • Upgrade number format parser to fix missing literal tokens in some cases
  • Update built-in zh-cn and zh-tw language number format
  • Fix the incorrect custom number format ID allocated, resolve issue #1677
  • Fix updating a table's range by removing it and creating it again doesn't work, resolve issue #1682
  • Fix a potential issue that stream reader temporary files can not be clear, resolve issue #1680
  • Fix incorrect formula calculation result in some cases, resolve issue #1681
  • Fix concurrency race conditions on get cell value, resolve issue #1687
  • Fix some format missing on get style definition, resolve issue #1708
  • Fix number format scientific notation zero fill issues, resolve issue #1710
  • Fix panic on read workbook with internal row element without r attribute, resolve issue #1723
  • Fix GetCellRichText returns error on getting inline rich text cells
  • Fix invalid shared string table index on set cell value in some cases
  • Fix GetConditionalFormats panic on get conditional format without above average rules, resolve issue #1745
  • Fix incorrect adjust merged cells on remove rows, resolve issue #1749
  • Fix the SetConditionalFormat function creates incorrect multiple conditional formats rules priority, resolve issue #1770
  • Fix the GetConditionalFormats function doesn't return gradient data bar rule, resolve issue #1769
  • Fix the GetStyle or GetConditionalStyle function to returns incorrect DecimalPlaces field value, resolve issue #1777
  • Fix the CalcCellValue function does not return raw value when enable RawCellValue, resolve issue #1803

Performance

  • Improves performance for adding and removing pivot table and images
  • Reduce memory consumption by trimming the rows and cells, resolve issue #1712

Miscellaneous

  • The dependencies module has been updated
  • Unit tests and godoc updated
  • 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:

  • fnickels (Francis Nickels III)
  • m12r (Matthias Endler)
  • Abdelaziz-Ouhammou
  • Juneezee (Eng Zer Jun)
  • yicixin (壹次心)
  • TeeRenJing (rjtee)
  • phperic (magicrabbit)
  • kjushka (Anton Petrov)
  • krstak (Marko Krstic)
  • lpxxn (Nick)
  • ByteFlyCoding
  • yangliyl (Yang Li)
  • 15535382838
  • TajangSec (Tajang)
  • lujin1 (lujin)
  • parkoo (Tian)
  • ZhangXiao1024 (ZX)
  • zcgly
  • bramvbilsen (Bram Vanbilsen)
  • user65536
  • tianaiyouqing (天爱有情)
  • cuishuang (cui fliter)
  • CooolNv (Xuesong)
  • yuegu520
  • oneweek20169902 (li)
  • 3zmx
  • 327674413
  • melf-xyzh (MELF晓宇)
  • L4nn15ter
  • rememberher (Jerry)
  • ooooooobh (cherry)
  • xxxwang1983
  • funa12
  • coolbit
  • taitaking (zhukewen)
  • kewenof
  • ivekkairi (Vivek Kairi)
  • edwardfward (Ed)

Log in or sign up for Devpost to join the conversation.

posted an update

We are pleased to announce the release of version 2.8.0. Featured are a handful of new areas of functionality and numerous bug fixes.

A summary of changes is available in the Release Notes. A full list of changes is available in the changelog.

Release Notes

The most notable changes in this release are:

Breaking Change

  • Rename exported variable ErrTableNameLength to ErrNameLength
  • Rename exported type PaneOptions to Selection
  • Rename the Runs field to Paragraph in the exported Comment data type
  • Remove the Lang field in the Style data type
  • Removed exported ChartTitle data type, and using the RichTextRun data type instead of it
  • Changed the data type for the DecimalPlaces to pointer of integer
  • Change the default point to pixels conversion factor, resolve issues #279 and #1536
  • Change the AddShape function signature: func (f *File) AddShape(sheet, cell string, opts *Shape) error to func (f *File) AddShape(sheet string, opts *Shape) error

Notable Features

  • Add new exported error variables ErrExistsTableName and ErrorFormControlValue
  • Add new options ShortDatePattern, LongDatePattern, LongTimePattern and CultureInfo in the Options data type, related issue #1199
  • Add new exported data type CultureName enumeration for country code
  • New functions GetTables and DeleteTablesupport to get and remove tables, related issues #674 and #1454
  • New function GetStyle support to get style definitions, related issues #314, #1520 and #1521
  • Support applying cell value with placeholder, padding, rounds numbers, currency, accounting and switches argument number format, and support applying date and time number format for 812 language tags, related issue #660
  • New support 10 formula functions: ARRAYTOTEXT, FORECAST, FORECAST.LINEAR, FREQUENCY, INTERCEPT, ODDFYIELD, ODDLPRICE, ODDLYIELD, PROB, VALUETOTEXT
  • Add file path length limitation details in the error message
  • New function GetPanes support to get sheet panes and view selection
  • New functions AddFormControl, GetFormControls and DeleteFormControl support to form controls, related issues #301 and #1169
  • The AddChart function support set primary titles, related issue #1553
  • The AddChart function support creating chart with a secondary series axis, related issue #518
  • The AddChart function support formatting and setting rich text titles for the chart, related issue #1588
  • Add check for shape type for the AddShape function, an error will be returned if no shape type is specified
  • Support read cell values formatted by the Japanese calendar number format, related issue #1590
  • The GetPictures function support read one cell anchor pictures, related issue #1585
  • The NewConditionalStyle function support to create a conditional format with number format and protection, related issue #1610

Improve the Compatibility

  • Support checking cell value length with multi-bytes characters, related issue #1517
  • Prevent create duplicate tables and defined name with the same name
  • Improve the cell comment box shape size compatibility with KingSoft WPS
  • Support fallback to default column width in sheet format property, related issue #1536
  • Made case in-sensitive for internal worksheet XML path to improve compatibility, related issue #1591

Bug Fixes

  • Escape XML characters after checking cell value length, fix stream writer generated file corrupted, resolve issues #1518, #1519 and #1530
  • Fix incorrect comment box size for multi-line plain text comments
  • Preventing format text cell value as a numeric, resolve issues #1523, #1528 and #1533
  • Fix race conditions for concurrency safety functions
  • Fix incorrect round millisecond for the date time
  • Fix incorrect number formatted result for date and time with 12 hours at AM
  • Fix incorrect formula functions SUMIFS and AVERAGEIFS result, resolve issue #1564
  • Fix basic arithmetic operator priority issues in the calculating engine, resolve issue #1599
  • Fix across worksheet reference issue for the formula calculation engine
  • Fix adjust table issue when after removing rows, resolve issue #1539
  • Support to get multiple images in one cell, resolve issue #1548
  • Fix the added picture position was incorrect in some cases, resolve issue #1560
  • Support adjusting the formula when inserting columns and rows, fix the workbook corruption caused by inserting columns or rows caused, resolve issue #1565
  • Formula function CONCAT, CONCATENATE support concatenation of multiple cell values, resolve issue #1569
  • Fix incorrect formula calculate results on a nested argument function which returns a numeric result, resolve issue #1582
  • Fix internal graphic object counter issues caused added picture was duplicated, resolve issue #1584
  • Fix read date time cell result was incorrectly caused by hours rounding issue, resolve issue #1587
  • Fix panic on getting merged cells with the same start and end axis

Performance

  • Optimizing regexp calls to improve performance, related issue #1532
  • This avoid unnecessary byte/string conversion, related issue #1541

Miscellaneous

  • The dependencies module has been updated
  • Simplify variable declaration and error return statements
  • Remove the built-in language number format code mapping with Unicode values
  • Remove the internal xlsxTabColor data type, using the xlsxColor data type instead of xlsxTabColor
  • Unit tests and godoc updated
  • 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:

  • IAkumaI (Valery Ozarnichuk)
  • sillydong (Chen Zhidong)
  • fudali113 (fudali)
  • Juneezee (Eng Zer Jun)
  • joehan109
  • yicixin (壹次心)
  • vb6iscool
  • chengcxy (chengxinyao)
  • lidp20
  • JDavidVR (David)
  • fsfsx
  • cnmlgbgithub

Log in or sign up for Devpost to join the conversation.

posted an update

We are pleased to announce the release of version 2.7.1. Featured are a handful of new areas of functionality and numerous bug fixes.

A summary of changes is available in the Release Notes. A full list of changes is available in the changelog.

Release Notes

The most notable changes in this release are:

Breaking Change

  • Remove the Color field in the ChartLine data type
  • Replace the data type ShapeParagraph with RichTextRun
  • Remove the Color field from the type Shape, and uses the Fill instead of it
  • Remove the exported type AutoFilterListOptions
  • Rename the exported type TableOptions to Table
  • The AddChart function require using ChartType enumeration value to specify the chart type
  • Change 7 functions signature:
    • Change the func (f *File) AutoFilter(sheet, rangeRef string, opts *AutoFilterOptions) error to func (f *File) AutoFilter(sheet, rangeRef string, opts []AutoFilterOptions) error
    • Change the func (f *File) AddPictureFromBytes(sheet, cell, name, extension string, file []byte, opts *GraphicOptions) error to func (f *File) AddPictureFromBytes(sheet, cell string, pic *Picture) error
    • Change the func (f *File) GetPicture(sheet, cell string) (string, []byte, error) to func (f *File) GetPictures(sheet, cell string) ([]Picture, error)
    • Change the func (f *File) AddVBAProject(bin string) error to func (f *File) AddVBAProject(file []byte) error
    • Change the func (f *File) GetComments() (map[string][]Comment, error) to func (f *File) GetComments(sheet string) ([]Comment, error)
    • Change the func (f *File) AddTable(sheet, rangeRef string, opts *TableOptions) error to func (f *File) AddTable(sheet string, table *Table) error
    • Change the func (sw *StreamWriter) AddTable(rangeRef string, opts *TableOptions) error to func (sw *StreamWriter) AddTable(table *Table) error

Notable Features

  • Add new functions SetSheetDimension and GetSheetDimension for workbook dimension supports, related issue #1463
  • The NewStyle function support to create of 17 kinds of fill variants styles
  • Increase max cell styles limit to 65430
  • The AddPicture function allowing insert BMP format images
  • The GetPictures function support to get multiple images in a cell
  • The SetConditionalFormat function support to creating a conditional format with a "stop if true" or "icon sets" rule
  • The SetConditionalFormat function support to set border color and create solid color for the color data bar, related issue #1462
  • The AddChart function support to set the format for the chart data series solid fill, related issue #1474
  • The AddChart function support to set the bubble size in a data series
  • The AddChart function support to specifies the values in second plot for the bar/pie of pie chart
  • The AddChart function support to set number format for chart data labels and axis, related issue #1499
  • The AddTable function support to specify if show header row of the table when create the table
  • The AddTable function support to validate table name, and added a new error constant ErrTableNameLength, related issue #1468
  • The AutoFilter function support to add multiple filter columns when create auto filter
  • The CalcCellValue function support to specify if applying number format style for the cell calculation result
  • The CalcCellValue function support double-byte chars for formula functions: LEFT, LEN, LENB, MID, MIDB, RIGHT and RIGHTB, related issue #1476
  • The CalcCellValue function now returns formula error string in the result, and using the error message in returns error, related issue #1490
  • Case-insensitive for the image file extension name, related issue #1503
  • The stream writer will be skip set cell value when got nil value, related issue #756
  • The GetCellHyperLink function support get cell hyperlink for merged cells
  • Add new exported data type ChartType for represents chart type enumeration

Improve the Compatibility

  • Add support for workbook function groups
  • Add support for strict theme namespace, related issue #1447
  • Fix panic caused by the workbook relationship part not exist
  • Improve compatibility with SST index which contains blank characters, related issue #1508

Bug Fixes

  • Fix decimal number format round issue in some cases
  • Fix incorrect cell type when modifying string cell with the time number, resolve issue #1464
  • Fix cell resolver caused incorrect calculation result, resolve issue #1469
  • Fix conditional format data bar min/max value doesn't work, resolve issue #1492
  • Supports 0 row height and column width, resolve issue #1461

Performance

  • Improve performance for apply number format with month name, related issue #1455
  • Speed up for checking merged cells, related issue #1448

Miscellaneous

  • A pure WebAssembly / Javascript port of Go Excelize library named excelize-wasm NPM package has been production-ready use
  • 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:

  • @liron-l (Liron Levin)
  • @nathj07 (Nathan Davies)
  • @Josh-Weston (Josh Weston)
  • @jaby
  • @FlowingSPDG (Shugo Kawamura)
  • @barismar (Baris Mar Aziz)
  • @doingNobb (张涛)
  • @rpoetrap (Rizki Putra)
  • @huangshaokun
  • @CHANTXU64 (ChantXu64)
  • @playGitboy

Log in or sign up for Devpost to join the conversation.