Closed ShowerBandV closed 1 week ago
Description Reading a cross sheet pivot table, it was found that the pivot table data source was obtained but not used, using the current sheetName
func (f *File) getPivotTable(sheet, pivotTableXML, pivotCacheRels string) (PivotTableOptions, error) { ... opts = PivotTableOptions{ pivotTableXML: pivotTableXML, pivotCacheXML: pivotCacheXML, pivotSheetName: sheet, //sheet is currentsheet,but dataRange need pc.CacheSource.WorksheetSource.Sheet DataRange: fmt.Sprintf("%s!%s", sheet, pc.CacheSource.WorksheetSource.Ref), PivotTableRange: fmt.Sprintf("%s!%s", sheet, pt.Location.Ref), Name: pt.Name, } ... }
here is demo code and a xlsx file:
func TestGetPivotTable(t *testing.T) { file, err := excelize.OpenFile("Book1.xlsx") if err != nil { panic(err) } tables, err := file.GetPivotTables("Sheet2") if err != nil { panic(err) } fmt.Println(tables) }
Book1.xlsx
Hi @ShowerBandV, thanks for your issue. Would you like to create a pull request to help us fix that?
Description Reading a cross sheet pivot table, it was found that the pivot table data source was obtained but not used, using the current sheetName
here is demo code and a xlsx file:
Book1.xlsx