Skip to content

Commit 8c6a440

Browse files
committed
Upgrade the dependencies package version
- Update docs for the functions - Upgrade build tool chain version
1 parent 397fcbb commit 8c6a440

File tree

6 files changed

+156
-45
lines changed

6 files changed

+156
-45
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ jobs:
110110
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
111111
brew tap messense/macos-cross-toolchains
112112
brew install FiloSottile/musl-cross/musl-cross mingw-w64
113-
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20250430/llvm-mingw-20250430-ucrt-macos-universal.tar.xz
114-
tar -xzf llvm-mingw-20250430-ucrt-macos-universal.tar.xz
115-
export PATH="$(pwd)/llvm-mingw-20250430-ucrt-macos-universal/bin:$PATH"
113+
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20250613/llvm-mingw-20250613-ucrt-macos-universal.tar.xz
114+
tar -xzf llvm-mingw-20250613-ucrt-macos-universal.tar.xz
115+
export PATH="$(pwd)/llvm-mingw-20250613-ucrt-macos-universal/bin:$PATH"
116116
CC=aarch64-linux-musl-gcc GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.arm64.linux.so main.go
117117
CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.amd64.windows.dll main.go
118118
CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.386.windows.dll main.go

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<p align="center"><img width="500" src="https://github.com/xuri/excelize-py/raw/main/excelize-py.svg" alt="excelize-py logo"></p>
44

55
<p align="center">
6-
<a href="https://pypi.org/project/excelize"><img src="https://img.shields.io/pypi/v/excelize?color=%23007ec6" alt="Pipy version"></a>
6+
<a href="https://pypi.org/project/excelize"><img src="https://img.shields.io/pypi/v/excelize?color=%23007ec6" alt="PyPI version"></a>
77
<a href="https://github.com/xuri/excelize-py/actions/workflows/build.yml"><img src="https://github.com/xuri/excelize-py/actions/workflows/build.yml/badge.svg" alt="Build Status"></a>
88
<a href="https://codecov.io/gh/xuri/excelize-py"><img src="https://codecov.io/gh/xuri/excelize-py/branch/main/graph/badge.svg" alt="Code Coverage"></a>
99
<a href="https://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-bsd-orange.svg" alt="Licenses"></a>
1010
<a href="https://www.paypal.com/paypalme/xuri"><img src="https://img.shields.io/badge/Donate-PayPal-green.svg" alt="Donate"></a>
1111
</p>
1212

13-
Package excelize-py is a Python port of Go [Excelize](https://github.com/xuri/excelize) library, providing a set of functions that allow you to write and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel&trade; 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 Python version 3.9 or later. The full API docs can be found at [docs reference](https://xuri.me/excelize/).
13+
Package excelize-py is a Python port of Go [Excelize](https://github.com/xuri/excelize) library, providing a set of functions that allow you to write and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel&trade; 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 Python version 3.9 or later. The full API docs can be found at [docs reference](https://xuri.me/excelize-py/).
1414

1515
## Platform Compatibility
1616

README_zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<p align="center"><img width="500" src="https://github.com/xuri/excelize-py/raw/main/excelize-py.svg" alt="excelize-py logo"></p>
44

55
<p align="center">
6-
<a href="https://pypi.org/project/excelize"><img src="https://img.shields.io/pypi/v/excelize?color=%23007ec6" alt="Pipy version"></a>
6+
<a href="https://pypi.org/project/excelize"><img src="https://img.shields.io/pypi/v/excelize?color=%23007ec6" alt="PyPI version"></a>
77
<a href="https://github.com/xuri/excelize-py/actions/workflows/build.yml"><img src="https://github.com/xuri/excelize-py/actions/workflows/build.yml/badge.svg" alt="Build Status"></a>
88
<a href="https://codecov.io/gh/xuri/excelize-py"><img src="https://codecov.io/gh/xuri/excelize-py/branch/main/graph/badge.svg" alt="Code Coverage"></a>
99
<a href="https://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-bsd-orange.svg" alt="Licenses"></a>
1010
<a href="https://www.paypal.com/paypalme/xuri"><img src="https://img.shields.io/badge/Donate-PayPal-green.svg" alt="Donate"></a>
1111
</p>
1212

13-
excelize-py 是 Go 语言 [Excelize](https://github.com/xuri/excelize) 基础库的 Python 实现,可用于操作 Office Excel 文档,基于 ECMA-376,ISO/IEC 29500 国际标准。可以使用它来读取、写入由 Microsoft Excel&trade; 2007 及以上版本创建的电子表格文档。支持 XLAM / XLSM / XLSX / XLTM / XLTX 等多种文档格式,高度兼容带有样式、图片(表)、透视表、切片器等复杂组件的文档。可应用于各类报表平台、云计算、边缘计算等系统。使用本软件包要求使用的 Python 语言为 3.9 或更高版本,获取更多信息请访问 [参考文档](https://xuri.me/excelize/)
13+
excelize-py 是 Go 语言 [Excelize](https://github.com/xuri/excelize) 基础库的 Python 实现,可用于操作 Office Excel 文档,基于 ECMA-376,ISO/IEC 29500 国际标准。可以使用它来读取、写入由 Microsoft Excel&trade; 2007 及以上版本创建的电子表格文档。支持 XLAM / XLSM / XLSX / XLTM / XLTX 等多种文档格式,高度兼容带有样式、图片(表)、透视表、切片器等复杂组件的文档。可应用于各类报表平台、云计算、边缘计算等系统。使用本软件包要求使用的 Python 语言为 3.9 或更高版本,获取更多信息请访问 [参考文档](https://xuri.me/excelize-py/)
1414

1515
## 运行环境兼容性
1616

excelize.py

Lines changed: 131 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,18 @@ def copy_sheet(self, src: int, to: int) -> None:
13591359
Returns:
13601360
None: Return None if no error occurred, otherwise raise a
13611361
RuntimeError with the message.
1362+
1363+
Example:
1364+
For example:
1365+
1366+
```python
1367+
try:
1368+
# Sheet1 already exists...
1369+
index = f.new_sheet("Sheet2")
1370+
f.copy_sheet(0, index)
1371+
except RuntimeError as err:
1372+
print(err)
1373+
```
13621374
"""
13631375
err, lib.CopySheet.restype = None, c_char_p
13641376
err = lib.CopySheet(self.file_index, src, to).decode(ENCODE)
@@ -1504,6 +1516,16 @@ def duplicate_row(self, sheet: str, row: int) -> None:
15041516
Returns:
15051517
None: Return None if no error occurred, otherwise raise a
15061518
RuntimeError with the message.
1519+
1520+
Example:
1521+
For example:
1522+
1523+
```python
1524+
try:
1525+
f.duplicate_row("Sheet1", 2)
1526+
except RuntimeError as err:
1527+
print(err)
1528+
```
15071529
"""
15081530
err, lib.DuplicateRow.restype = None, c_char_p
15091531
err = lib.DuplicateRow(self.file_index, sheet.encode(ENCODE), row).decode(
@@ -1529,6 +1551,16 @@ def duplicate_row_to(self, sheet: str, row: int, row2: int) -> None:
15291551
Returns:
15301552
None: Return None if no error occurred, otherwise raise a
15311553
RuntimeError with the message.
1554+
1555+
Example:
1556+
For example:
1557+
1558+
```python
1559+
try:
1560+
f.duplicate_row_to("Sheet1", 2, 7)
1561+
except RuntimeError as err:
1562+
print(err)
1563+
```
15321564
"""
15331565
err, lib.DuplicateRowTo.restype = None, c_char_p
15341566
err = lib.DuplicateRowTo(
@@ -2016,8 +2048,8 @@ def get_sheet_index(self, sheet: str) -> int:
20162048

20172049
def get_sheet_list(self) -> List[str]:
20182050
"""
2019-
GetSheetList provides a function to get worksheets, chart sheets, and
2020-
dialog sheets name list of the workbook.
2051+
Get worksheets, chart sheets, and dialog sheets name list of the
2052+
workbook.
20212053
20222054
Returns:
20232055
List[str]: Return the sheet name list if no error occurred,
@@ -2030,12 +2062,32 @@ def get_sheet_list(self) -> List[str]:
20302062

20312063
def get_sheet_map(self) -> Dict[int, str]:
20322064
"""
2033-
GetSheetMap provides a function to get worksheets, chart sheets, dialog
2034-
sheets ID, and name maps of the workbook.
2065+
Get worksheets, chart sheets, dialog sheets ID, and name maps of the
2066+
workbook.
20352067
20362068
Returns:
20372069
Dict[int, str]: Return the sheet ID and name map if no error
20382070
occurred, otherwise return an empty dictionary.
2071+
2072+
Example:
2073+
For example:
2074+
2075+
```python
2076+
try:
2077+
f = excelize.open_file("Book1.xlsx")
2078+
except RuntimeError as err:
2079+
print(err)
2080+
exit()
2081+
try:
2082+
for index, name in f.get_sheet_map().items():
2083+
print(index, name)
2084+
except RuntimeError as err:
2085+
print(err)
2086+
finally:
2087+
err = f.close()
2088+
if err:
2089+
print(err)
2090+
```
20392091
"""
20402092
lib.GetSheetMap.restype = types_go._GetSheetMapResult
20412093
sheet_map = dict()
@@ -2468,7 +2520,7 @@ def protect_workbook(self, opts: WorkbookProtectionOptions) -> None:
24682520
"""
24692521
Prevent other users from viewing hidden worksheets, adding, moving,
24702522
deleting, or hiding worksheets, and renaming worksheets in a workbook.
2471-
The optional field AlgorithmName specified hash algorithm, support XOR,
2523+
The optional field algorithm_name specified hash algorithm, support XOR,
24722524
MD4, MD5, SHA-1, SHA2-56, SHA-384, and SHA-512 currently, if no hash
24732525
algorithm specified, will be using the XOR algorithm as default. The
24742526
generated workbook only works on Microsoft Office 2007 and later.
@@ -3127,6 +3179,15 @@ def set_col_visible(self, sheet: str, columns: str, visible: bool) -> None:
31273179
except RuntimeError as err:
31283180
print(err)
31293181
```
3182+
3183+
Hide the columns from `D` to `F` (included):
3184+
3185+
```python
3186+
try:
3187+
f.set_col_visible("Sheet1", "D:F", False)
3188+
except RuntimeError as err:
3189+
print(err)
3190+
```
31303191
"""
31313192
lib.SetColVisible.restype = c_char_p
31323193
err = lib.SetColVisible(
@@ -3238,18 +3299,39 @@ def set_defined_name(self, defined_name: DefinedName) -> None:
32383299
RuntimeError with the message.
32393300
32403301
Example:
3241-
For example, create a table of A1:D5 on Sheet1:
3302+
For example:
32423303
32433304
```python
3244-
try:
3245-
f.set_defined_name(excelize.DefinedName(
3246-
name="Amount",
3247-
refers_to="Sheet1!$A$2:$D$5",
3248-
comment="defined name comment",
3249-
scope="Sheet2",
3250-
))
3251-
except RuntimeError as err:
3252-
print(err)
3305+
f.set_defined_name(excelize.DefinedName(
3306+
name="Amount",
3307+
refers_to="Sheet1!$A$2:$D$5",
3308+
comment="defined name comment",
3309+
scope="Sheet2",
3310+
))
3311+
```
3312+
3313+
If you fill the `refers_to` property with only one columns range
3314+
without a comma, it will work as "Columns to repeat at left" only.
3315+
For example:
3316+
3317+
```python
3318+
f.set_defined_name(excelize.DefinedName(
3319+
name="_xlnm.Print_Titles",
3320+
refers_to="Sheet1!$A:$A",
3321+
scope="Sheet1"
3322+
))
3323+
```
3324+
3325+
If you fill the `refers_to` property with only one rows range
3326+
without a comma, it will work as "Rows to repeat at top" only.
3327+
For example:
3328+
3329+
```python
3330+
f.set_defined_name(excelize.DefinedName(
3331+
name="_xlnm.Print_Titles",
3332+
refers_to="Sheet1!$1:$1",
3333+
scope="Sheet1"
3334+
))
32533335
```
32543336
"""
32553337
lib.SetDefinedName.restype = c_char_p
@@ -3279,11 +3361,11 @@ def set_doc_props(self, doc_properties: DocProperties) -> None:
32793361
category="category",
32803362
content_status="Draft",
32813363
created="2019-06-04T22:00:10Z",
3282-
creator="Go Excelize",
3283-
description="This file created by Go Excelize",
3364+
creator="Excelize for Python",
3365+
description="This file created by Excelize for Python",
32843366
identifier="xlsx",
32853367
keywords="Spreadsheet",
3286-
last_modified_by="Go Author",
3368+
last_modified_by="Author Name",
32873369
modified="2019-06-04T22:00:10Z",
32883370
revision="0",
32893371
subject="Test Subject",
@@ -3440,7 +3522,7 @@ def set_row_height(self, sheet: str, row: int, height: float) -> None:
34403522
def set_row_outline_level(self, sheet: str, row: int, level: int) -> None:
34413523
"""
34423524
Set outline level number of a single row by given worksheet name and
3443-
Excel row number. The value of parameter 'level' is 1-7.
3525+
row number. The range of `level` parameter value from 1 to 7.
34443526
34453527
Args:
34463528
sheet (str): The worksheet name
@@ -3609,6 +3691,17 @@ def set_sheet_col(
36093691
Returns:
36103692
None: Return None if no error occurred, otherwise raise a
36113693
RuntimeError with the message.
3694+
3695+
Example:
3696+
For example, writes an array to column `B` start with the cell `B6`
3697+
on `Sheet1`:
3698+
3699+
```python
3700+
try:
3701+
f.set_sheet_col("Sheet1", "B6", ["1", None, 2])
3702+
except RuntimeError as err:
3703+
print(err)
3704+
```
36123705
"""
36133706
lib.SetSheetCol.restype = c_char_p
36143707
vals = (types_go._Interface * len(values))()
@@ -3713,6 +3806,17 @@ def set_sheet_row(
37133806
Returns:
37143807
None: Return None if no error occurred, otherwise raise a
37153808
RuntimeError with the message.
3809+
3810+
Example:
3811+
For example, writes an array to row `6` start with the cell `B6` on
3812+
`Sheet1`:
3813+
3814+
```python
3815+
try:
3816+
f.set_sheet_row("Sheet1", "B6", ["1", None, 2])
3817+
except RuntimeError as err:
3818+
print(err)
3819+
```
37163820
"""
37173821
lib.SetSheetRow.restype = c_char_p
37183822
vals = (types_go._Interface * len(values))()
@@ -3765,6 +3869,13 @@ def set_sheet_visible(self, sheet: str, visible: bool, *very_hidden: bool) -> No
37653869
Returns:
37663870
None: Return None if no error occurred, otherwise raise a
37673871
RuntimeError with the message.
3872+
3873+
Example:
3874+
For example, hide `Sheet1`:
3875+
3876+
```python
3877+
f.set_sheet_visible("Sheet1", False)
3878+
```
37683879
"""
37693880
lib.SetSheetVisible.restype = c_char_p
37703881
vh = False
@@ -3957,7 +4068,7 @@ def new_file() -> File:
39574068

39584069
def open_file(filename: str, *opts: Options) -> File:
39594070
"""
3960-
OpenFile take the name of a spreadsheet file and returns a populated
4071+
This function take the name of a spreadsheet file and returns a populated
39614072
spreadsheet file struct for it.
39624073
39634074
Args:

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ module github.com/xuri/excelize-py
33
go 1.23.0
44

55
require (
6-
github.com/xuri/excelize/v2 v2.9.2-0.20250527011656-c46099ee67be
6+
github.com/xuri/excelize/v2 v2.9.2-0.20250614235856-d434acdde46b
77
golang.org/x/image v0.27.0
88
)
99

1010
require (
1111
github.com/richardlehane/mscfb v1.0.4 // indirect
1212
github.com/richardlehane/msoleps v1.0.4 // indirect
13-
github.com/tiendc/go-deepcopy v1.6.0 // indirect
13+
github.com/tiendc/go-deepcopy v1.6.1 // indirect
1414
github.com/xuri/efp v0.0.1 // indirect
15-
github.com/xuri/nfp v0.0.1 // indirect
16-
golang.org/x/crypto v0.38.0 // indirect
17-
golang.org/x/net v0.40.0 // indirect
18-
golang.org/x/text v0.25.0 // indirect
15+
github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9 // indirect
16+
golang.org/x/crypto v0.39.0 // indirect
17+
golang.org/x/net v0.41.0 // indirect
18+
golang.org/x/text v0.26.0 // indirect
1919
)

go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ github.com/richardlehane/msoleps v1.0.4 h1:WuESlvhX3gH2IHcd8UqyCuFY5yiq/GR/yqaSM
99
github.com/richardlehane/msoleps v1.0.4/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
1010
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
1111
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
12-
github.com/tiendc/go-deepcopy v1.6.0 h1:0UtfV/imoCwlLxVsyfUd4hNHnB3drXsfle+wzSCA5Wo=
13-
github.com/tiendc/go-deepcopy v1.6.0/go.mod h1:toXoeQoUqXOOS/X4sKuiAoSk6elIdqc0pN7MTgOOo2I=
12+
github.com/tiendc/go-deepcopy v1.6.1 h1:uVRTItFeNHkMcLueHS7OCsxgxT9P8MzGB/taUa2Y4Tk=
13+
github.com/tiendc/go-deepcopy v1.6.1/go.mod h1:toXoeQoUqXOOS/X4sKuiAoSk6elIdqc0pN7MTgOOo2I=
1414
github.com/xuri/efp v0.0.1 h1:fws5Rv3myXyYni8uwj2qKjVaRP30PdjeYe2Y6FDsCL8=
1515
github.com/xuri/efp v0.0.1/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
16-
github.com/xuri/excelize/v2 v2.9.2-0.20250527011656-c46099ee67be h1:hPXzrTtRmS2byp4c5RRKmj4vYahw5Yw0+ZGVfMojI00=
17-
github.com/xuri/excelize/v2 v2.9.2-0.20250527011656-c46099ee67be/go.mod h1:x7L6pKz2dvo9ejrRuD8Lnl98z4JLt0TGAwjhW+EiP8s=
18-
github.com/xuri/nfp v0.0.1 h1:MDamSGatIvp8uOmDP8FnmjuQpu90NzdJxo7242ANR9Q=
19-
github.com/xuri/nfp v0.0.1/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
20-
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
21-
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
16+
github.com/xuri/excelize/v2 v2.9.2-0.20250614235856-d434acdde46b h1:0+9AA5rFR07411NM9EdIagfecnG5weEFYgsiiPV/O+s=
17+
github.com/xuri/excelize/v2 v2.9.2-0.20250614235856-d434acdde46b/go.mod h1:isQygQdjiU88/HpJYtp+6TN/FH29HvVjWT8vFk3t5+w=
18+
github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9 h1:+C0TIdyyYmzadGaL/HBLbf3WdLgC29pgyhTjAT/0nuE=
19+
github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
20+
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
21+
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
2222
golang.org/x/image v0.27.0 h1:C8gA4oWU/tKkdCfYT6T2u4faJu3MeNS5O8UPWlPF61w=
2323
golang.org/x/image v0.27.0/go.mod h1:xbdrClrAUway1MUTEZDq9mz/UpRwYAkFFNUslZtcB+g=
24-
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
25-
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
26-
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
27-
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
24+
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
25+
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
26+
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
27+
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
2828
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2929
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)