How to use the tableaudocumentapi.Workbook function in tableaudocumentapi

To help you get started, we’ve selected a few tableaudocumentapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tableau / document-api-python / test / bvt.py View on Github external
def test_can_extract_datasourceV10(self):
        wb = Workbook(self.workbook_file.name)
        self.assertEqual(len(wb.datasources), 1)
        self.assertEqual(len(wb.datasources[0].connections), 2)
        self.assertIsInstance(wb.datasources[0].connections, list)
        self.assertIsInstance(wb.datasources[0], Datasource)
        self.assertEqual(wb.datasources[0].name,
                         'federated.1s4nxn20cywkdv13ql0yk0g1mpdx')
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_get_worksheets(self):
        wb = Workbook(self.workbook_file.name)
        self.assertIsNotNone(wb.worksheets)
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_get_worksheets(self):
        wb = Workbook(self.workbook_file.name)
        self.assertIsNotNone(wb.worksheets)
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_open_twbx_and_save_changes(self):
        original_wb = Workbook(self.workbook_file.name)
        original_wb.datasources[0].connections[0].server = 'newdb'
        original_wb.save()

        new_wb = Workbook(self.workbook_file.name)
        self.assertEqual(new_wb.datasources[0].connections[
                         0].server, 'newdb')
github tableau / document-api-python / test / bvt.py View on Github external
def test_has_filename(self):
        wb = Workbook(self.workbook_file.name)
        self.assertEqual(wb.filename, self.workbook_file.name)
github tableau / document-api-python / test / bvt.py View on Github external
def test_save_has_xml_declaration(self):
        original_wb = Workbook(self.workbook_file.name)
        original_wb.datasources[0].connections[0].dbname = 'newdb'

        original_wb.save()

        with open(self.workbook_file.name) as f:
            first_line = f.readline().strip()  # first line should be xml tag
            self.assertEqual(
                first_line, "")
github tableau / document-api-python / test / test_datasource.py View on Github external
def setUp(self):
        self.wb = Workbook(TEST_TWB_FILE)
        # Assume the first datasource in the file
        self.ds = self.wb.datasources[0]
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_update_datasource_connection_and_saveV10(self):
        original_wb = Workbook(self.workbook_file.name)
        original_wb.datasources[0].connections[0].dbname = 'newdb'

        original_wb.save()

        new_wb = Workbook(self.workbook_file.name)
        self.assertEqual(new_wb.datasources[0].connections[
                         0].dbname, 'newdb')
github tableau / document-api-python / test / bvt.py View on Github external
def test_exception_when_workbook_given_tdsx(self):
        with self.assertRaises(TableauInvalidFileException):
            wb = Workbook(TABLEAU_10_TDSX)
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_open_twbx_and_save_as_changes(self):
        new_twbx_filename = 'newtwbx.twbx'
        original_wb = Workbook(self.workbook_file.name)
        original_wb.datasources[0].connections[0].server = 'newdb'
        original_wb.save_as(new_twbx_filename)

        new_wb = Workbook(new_twbx_filename)
        self.assertEqual(new_wb.datasources[0].connections[
                         0].server, 'newdb')

        os.unlink(new_twbx_filename)