こんな事も分からないの?
痴呆症を疑うレベルw

エラーメッセージ
object has no attribute 'refresh'

# ピボットテーブルを更新
pivot_table = sheet2.api.PivotTables('Pivottable1')
pivot_table.refresh()