summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/pivot_table.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/pivot_table.rb b/examples/pivot_table.rb
index 229ed8c9..07d03d55 100644
--- a/examples/pivot_table.rb
+++ b/examples/pivot_table.rb
@@ -27,7 +27,12 @@ end
wb.add_worksheet(:name => "Data Sheet") do |sheet|
sheet.add_row ['Month', 'Year', 'Type', 'Sales', 'Region']
30.times { sheet.add_row [month, year, type, sales, region] }
- sheet.add_pivot_table 'G4:L17', "A1:E31"
+ sheet.add_pivot_table 'G4:L17', "A1:E31" do |pivot_table|
+ pivot_table.rows = ['Month', 'Year']
+ pivot_table.columns = ['Type']
+ pivot_table.data = ['Sales']
+ pivot_table.pages = ['Region']
+ end
end
# Write the excel file