Dim xla As New ExcelApplication()
Dim wb As Workbook = xla.Open("C:\MySpreadsheet.xls")
Dim ws As Worksheet = wb.Worksheets(0)
Dim df As DataField = ws.PivotTables(0).DataFields(0)
df.SummarizeBy = PivotTableField.SummarizebyType.Average;
DataFields are set to Count for string values and Sum for numerical values by default.