File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ load ("@rules_python//python:defs.bzl" , "py_binary" )
2+
3+ py_binary (
4+ name = "remove-dashboard" ,
5+ srcs = ["__main__.py" ],
6+ main = "__main__.py" ,
7+ visibility = ["//:__subpackages__" ],
8+ deps = ["//tableaudocumentapi" ],
9+ )
Original file line number Diff line number Diff line change 1+ from tableaudocumentapi import Workbook
2+
3+ # Load the workbook
4+ # twb = Workbook('/data/jenkins/workspace/internal/platform/devops-internal/tableau-test/workbook/test.twb')
5+
6+ twb = Workbook ("/Users/gdowding/git/github.com/tableau/SR Backlog.twb" )
7+ # Keep only desired sheets
8+
9+ print ("before deleting dashboard from workbook" )
10+ for dashboard in twb .dashboards :
11+ print (dashboard )
12+
13+ db0_name = twb .dashboards [0 ]
14+ print (f"removing dashboard { db0_name } \n " )
15+
16+ # twb.remove_dashboard_by_name(db0_name)
17+
18+ print ("\n after deleting dashboard from workbook\n " )
19+ for dashboard in twb .dashboards :
20+ print (dashboard )
21+
22+
23+ # Save the filtered workbook
24+ print ("saving file with new name: test_new.twb\n " )
25+ twb .save_as ("/Users/gdowding/git/github.com/tableau/test_new.twb" )
26+
27+
28+ print ("loading new file and checking\n " )
29+ # Load the workbook
30+ # twb = Workbook('/data/jenkins/workspace/internal/platform/devops-internal/tableau-test/workbook/test_new.twb')
31+
32+ twb_new = Workbook ("/Users/gdowding/git/github.com/tableau/test_new.twb" )
33+ # Keep only desired sheets
34+
35+ for dashboard in twb_new .dashboards :
36+ print (dashboard )
Original file line number Diff line number Diff line change 1+ load ("@rules_python//python:defs.bzl" , "py_binary" )
2+
3+ py_binary (
4+ name = "remove-sheet" ,
5+ srcs = ["__main__.py" ],
6+ main = "__main__.py" ,
7+ visibility = ["//:__subpackages__" ],
8+ deps = ["//tableaudocumentapi" ],
9+ )
Original file line number Diff line number Diff line change 1+ from tableaudocumentapi import Workbook
2+
3+ # Load the workbook
4+ # twb = Workbook('/data/jenkins/workspace/internal/platform/devops-internal/tableau-test/workbook/test.twb')
5+
6+ twb = Workbook ("/Users/gdowding/git/github.com/tableau/SR Backlog.twb" )
7+ # Keep only desired sheets
8+
9+ print ("before deleting worksheet from workbook" )
10+ for worksheet in twb .worksheets :
11+ print (worksheet )
12+
13+ del twb .worksheets [3 ]
14+
15+ wb3_name = twb .worksheets [3 ]
16+ print (f"removing worksheet { wb3_name } \n " )
17+
18+ twb .remove_worksheet_by_name (wb3_name )
19+
20+ print ("\n after deleting worksheet from workbook\n " )
21+ for worksheet in twb .worksheets :
22+ print (worksheet )
23+
24+
25+ # Save the filtered workbook
26+ print ("saving file with new name: test_new.twb\n " )
27+ twb .save_as ("/Users/gdowding/git/github.com/tableau/test_new.twb" )
28+
29+
30+ print ("loading new file and checking\n " )
31+ # Load the workbook
32+ # twb = Workbook('/data/jenkins/workspace/internal/platform/devops-internal/tableau-test/workbook/test_new.twb')
33+
34+ twb_new = Workbook ("/Users/gdowding/git/github.com/tableau/test_new.twb" )
35+ # Keep only desired sheets
36+
37+ for worksheet in twb_new .worksheets :
38+ print (worksheet )
You can’t perform that action at this time.
0 commit comments