{"id":18840,"library":"tableau-api","title":"tableau-api","description":"NPM wrapper for the Tableau JavaScript API (v2.2.3, last release December 2020). This package provides a convenient way to include the Tableau JS library in Node.js or browser bundlers (Webpack, Rollup). It mirrors the official Tableau JS API, which allows embedding Tableau visualizations, interacting with workbooks and sheets, and extracting underlying data. Key differentiators: simplifies dependency management for Tableau JS compared to manual script tags; however, it lags behind the official CDN version (current Tableau API is v3.x). Release cadence is low (last update in 2020). For new projects, prefer the official CDN or the '@tableau/embedding-api' package.","status":"maintenance","version":"2.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/cmtoomey/tableau-api","tags":["javascript"],"install":[{"cmd":"npm install tableau-api","lang":"bash","label":"npm"},{"cmd":"yarn add tableau-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add tableau-api","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM import is preferred; CommonJS require also works but is not tree-shakable.","wrong":"const tableau = require('tableau-api');","symbol":"default (tableau)","correct":"import tableau from 'tableau-api';"},{"note":"tableau is attached to window; after importing tableau-api, use window.tableau objects.","wrong":"const viz = new tableau.Viz(container, url, options);","symbol":"Viz","correct":"const viz = new window.tableau.Viz(container, url, options);"},{"note":"Worksheets collection uses .get(name) not array indexing.","wrong":"const sheet = viz.getWorkbook().getActiveSheet().getWorksheets()[0];","symbol":"Worksheet","correct":"const sheet = viz.getWorkbook().getActiveSheet().getWorksheets().get('Table');"}],"quickstart":{"code":"import tableau from 'tableau-api';\nconst container = document.getElementById('vizContainer');\nconst url = 'https://public.tableau.com/views/WorldIndicators/GDPpercapita?:embed=y';\nconst options = {\n  hideTabs: true,\n  width: '800px',\n  height: '600px',\n  onFirstInteractive: () => {\n    const sheet = viz.getWorkbook().getActiveSheet();\n    sheet.getUnderlyingDataAsync().then(data => console.log(data));\n  }\n};\nconst viz = new window.tableau.Viz(container, url, options);","lang":"javascript","description":"Embeds a Tableau visualization and logs underlying data when interactive."},"warnings":[{"fix":"Always use 'new window.tableau.Viz(...)' after importing 'tableau-api'.","message":"Using window.tableau.Viz instead of imported tableau.Viz: the package only adds the tableau script to window; direct named imports like tableau.Viz do not exist.","severity":"gotcha","affected_versions":"*"},{"fix":"Migrate to @tableau/embedding-api or use CDN script for v3.","message":"Tableau JS API v2 (embedded in this package) is deprecated by Tableau; v3 is available via CDN or @tableau/embedding-api.","severity":"deprecated","affected_versions":"2.0 - 2.2.3"},{"fix":"Use dynamic import or only load in browser environment.","message":"Importing in server-side rendering (SSR) environments: package expects browser globals (window, document) which are not available in Node.js.","severity":"gotcha","affected_versions":"*"},{"fix":"Pin to v2.0 if you need bundled version.","message":"Breaking change: In v2.1, the package switched from bundling the full Tableau JS API to referencing the CDN, breaking users who depended on the bundled version.","severity":"breaking","affected_versions":">=2.1 <2.0"},{"fix":"Refer to official Tableau JS API docs for current return types.","message":"The 'getUnderlyingDataAsync' method previously returned a promise with .getData() method; now returns data directly? Check Tableau docs.","severity":"deprecated","affected_versions":">=2.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use 'window.tableau.Viz(...)' instead of 'tableau.Viz(...)'.","cause":"Imported package but forgot that tableau is attached to window.","error":"TypeError: tableau is not defined"},{"fix":"Ensure code runs only in browser; use dynamic import or conditional check.","cause":"Code running in Node.js or SSR where window is not available.","error":"Uncaught ReferenceError: window is not defined"},{"fix":"Wait for tableau script to load: use 'tableau' global, not import.","cause":"tableau-api not properly imported or CDN script not loaded.","error":"Cannot read property 'Viz' of undefined"},{"fix":"Run 'npm install tableau-api' and ensure correct import path.","cause":"Package not installed or not in node_modules.","error":"Module not found: Error: Can't resolve 'tableau-api'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}