Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pivot Data Type: Allow Sum/Count/Avarage #582

Closed
qin-nz opened this issue Feb 19, 2020 · 3 comments
Closed

Pivot Data Type: Allow Sum/Count/Avarage #582

qin-nz opened this issue Feb 19, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@qin-nz
Copy link

qin-nz commented Feb 19, 2020

在 Excel 里, Pivot 表可以对值类型选择需要的操作,比如计数、求和、平均值

image

excelize.PivotTableOption{
        DataRange:       "Sheet1!$A$1:$E$31",
        PivotTableRange: "Sheet1!$G$2:$M$34",
        Rows:            []string{"Month", "Year"},
        Columns:         []string{"Type"},
        Data:            []string{"Sales"},
    }

是不是应该增加一个

   DataType:            []string{"Count"},
@xuri xuri added the enhancement New feature or request label Feb 19, 2020
@xuri xuri closed this as completed in 6dcb701 Feb 21, 2020
@xuri
Copy link
Member

xuri commented Feb 21, 2020

Hi, @qin-nz, thanks for your issue. I have added support for setting date field subtotal and names of the pivot table. Please try to upgrade the library with the master branch code.

@qin-nz
Copy link
Author

qin-nz commented Feb 26, 2020

@xuri Data is slice of string, so DataSubtotal should also be slice instead of string.
Excel allow different data use different fo subtotal type.

@xuri
Copy link
Member

xuri commented Feb 26, 2020

I have added a new structure PivotTableField to hold pivot table fields for better scalability, which caused API changes. In addition, two or more fields in Data are not supported currently.

nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
…pivot table

- typo fixed and update do.dev badge in the README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants