{"id":2302,"library":"tablib","title":"Tablib: Pythonic Tabular Datasets","description":"Tablib is an MIT-licensed, format-agnostic tabular dataset library for Python, enabling Pythonic import, export, and manipulation of tabular data. It supports various formats like XLS, JSON, YAML, CSV, Pandas DataFrames, and HTML. Maintained by the Jazzband community, it is currently in version 3.9.0 and receives regular updates for Python compatibility and bug fixes.","status":"active","version":"3.9.0","language":"python","source_language":"en","source_url":"https://github.com/jazzband/tablib","tags":["tabular data","excel","csv","json","yaml","export","import","dataset","data manipulation","formats"],"install":[{"cmd":"pip install tablib","lang":"bash","label":"Core installation"},{"cmd":"pip install \"tablib[all]\"","lang":"bash","label":"Installation with all optional format dependencies"},{"cmd":"pip install \"tablib[xlsx, pandas, yaml]\"","lang":"bash","label":"Installation with specific optional format dependencies"}],"dependencies":[{"reason":"For OpenDocument Spreadsheet (ODS) format support.","package":"odfpy","optional":true},{"reason":"For Excel 07+ Spreadsheet (XLSX) format support.","package":"openpyxl","optional":true},{"reason":"For Pandas DataFrame export/import support.","package":"pandas","optional":true},{"reason":"For YAML format support.","package":"pyyaml","optional":true},{"reason":"For CLI table format export support.","package":"tabulate","optional":true},{"reason":"For Legacy Excel Spreadsheet (XLS) import support.","package":"xlrd","optional":true},{"reason":"For Legacy Excel Spreadsheet (XLS) export support.","package":"xlwt","optional":true}],"imports":[{"symbol":"Dataset","correct":"from tablib import Dataset"},{"note":"Used for handling multiple Dataset objects, typically for multi-sheet Excel files.","symbol":"Databook","correct":"from tablib import Databook"}],"quickstart":{"code":"import tablib\n\n# Create a new Dataset\ndata = tablib.Dataset()\n\n# Add headers\ndata.headers = ['First Name', 'Last Name', 'Age']\n\n# Add rows\ndata.append(['Kenneth', 'Reitz', 22])\ndata.append(['Bessie', 'Monke', 20])\n\n# Add a new column with data\ndata.append_col([True, False], header='Is Student')\n\nprint(\"CSV Export:\")\nprint(data.export('csv'))\n\nprint(\"\\nJSON Export:\")\nprint(data.export('json'))\n\n# Example of saving to a file (uncomment to run)\n# with open('output.xlsx', 'wb') as f:\n#     f.write(data.export('xlsx'))\n# print(\"\\nData exported to output.xlsx\")","lang":"python","description":"This quickstart demonstrates how to create a `Dataset` object, add headers, append rows, add a new column, and then export the data to different formats like CSV and JSON. It also includes a commented-out example for exporting to an XLSX file."},"warnings":[{"fix":"Review code using `lpush` or `rpush` on `Row` objects when upgrading to 2.0.0+ to ensure the intended prepend/append behavior.","message":"The logic for `Row.lpush` and `Row.rpush` methods was reversed in Tablib 2.0.0. In versions 1.x, `lpush` appended and `rpush` prepended, which was non-standard. This was corrected in 2.0.0.","severity":"breaking","affected_versions":"1.x -> 2.0.0"},{"fix":"Ensure your project uses Python 3.6+ for Tablib 3.x.","message":"Python 2 support was dropped with Tablib 1.0.0. Python 3.5 support was dropped with Tablib 3.0.0.","severity":"breaking","affected_versions":"<1.0.0 for Python 2, <3.0.0 for Python 3.5"},{"fix":"If upgrading from pre-1.0.0 and encountering `ImportError` for format-specific modules, use `pip install \"tablib[all]\"` or install specific format dependencies like `pip install \"tablib[xlsx]\"`.","message":"Starting with Tablib 1.0.0, all format dependencies became optional. Previously, they might have been installed by default. To install all possible format dependencies, you now need to use `pip install \"tablib[all]\"`.","severity":"breaking","affected_versions":"<1.0.0 -> 1.0.0+"},{"fix":"Always open CSV files with `newline=''` when exporting Tablib's CSV output to a file: `with open('output.csv', 'w', newline='') as f: f.write(data.export('csv'))`.","message":"When exporting CSV files on Windows, if you don't specify `newline=''` when opening the file in write mode, Excel might display a blank line between each row.","severity":"gotcha","affected_versions":"All versions (Python's `csv` module behavior)"},{"fix":"For datasets exceeding 65,000 rows, export to XLSX (`data.export('xlsx')`) rather than XLS (`data.export('xls')`).","message":"The legacy XLS format (Excel 97-2003) has a limitation of 65,000 rows. If you are dealing with larger datasets, you should use the XLSX format instead.","severity":"gotcha","affected_versions":"All versions when using XLS"},{"fix":"If encountering issues with large XLSX/ODS files not importing fully, consider checking the spreadsheet source or, if possible, disable `read_only` (though this might increase memory usage for large files).","message":"When importing XLSX or ODS files with `read_only=True` (which is the default for XLSX), Tablib relies on the spreadsheet declaring correct dimensions. Some programs might generate files with incorrect dimensions, leading to incomplete reads.","severity":"gotcha","affected_versions":"All versions with lazy reading"}],"env_vars":null,"search_vec":"'3.9.0':51 'agnost':13 'bug':60 'communiti':45 'compat':58 'csv':36,65 'current':48 'data':27,63,71 'datafram':38 'dataset':4,15,70 'enabl':19 'excel':64 'export':22,68 'fix':61 'format':12,31,73 'format-agnost':11 'html':40 'import':21,69 'jazzband':44 'json':34,66 'librari':16 'licens':10 'like':32 'maintain':41 'manipul':24,72 'mit':9 'mit-licens':8 'panda':37 'python':2,18,20,57 'receiv':53 'regular':54 'support':29 'tablib':1,5 'tabular':3,14,26,62 'updat':55 'various':30 'version':50 'xls':33 'yaml':35,67","created_at":"2026-04-09T18:52:09.772146+00:00","updated_at":"2026-04-16T22:39:40.017708+00:00","problems":[{"fix":"pip install tablib","cause":"The tablib library has not been installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'tablib'"},{"fix":"my_dataset.export('json')","cause":"Users incorrectly attempt to access export formats (like 'json', 'csv', 'xlsx') as direct attributes or methods of a Dataset object, instead of using the export() method with the format string.","error":"AttributeError: 'Dataset' object has no attribute 'json'"},{"fix":"pip install openpyxl (or the specific dependency mentioned in the error for the desired format, e.g., `pip install xlwt` for XLS, `pip install pandas` for DataFrames).","cause":"The user is attempting to import or export data in a specific format (e.g., XLSX) that requires an optional dependency which has not been installed.","error":"ImportError: You need to install 'openpyxl' to import/export .xlsx files."},{"fix":"Ensure that data appended to the Dataset is provided as an iterable, such as `my_dataset.append(['value1', 'value2'])` or `my_dataset.append(('value1', 'value2'))`.","cause":"This error often occurs when attempting to append a single, non-iterable item (like an integer or a string) as a row to a Dataset, but Dataset methods like append() or add_row() expect an iterable (list or tuple) representing the row's values.","error":"TypeError: 'int' object is not iterable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.10.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://tablib.readthedocs.io","github":"https://github.com/jazzband/tablib","docs":"https://tablib.readthedocs.io","changelog":"https://github.com/jazzband/tablib/blob/master/HISTORY.md","pypi":"https://pypi.org/project/tablib/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}