{"id":2686,"library":"pyexcel-io","title":"Pyexcel IO","description":"Pyexcel-io is a Python library providing a unified API to read and write structured data from various file formats (CSV, TSV, and extensions like XLS, XLSX, ODS via plugins) and databases (SQLAlchemy, Django models). It focuses on data processing, not formatting, fonts, or charts. It is actively maintained with frequent minor releases.","status":"active","version":"0.6.7","language":"python","source_language":"en","source_url":"https://github.com/pyexcel/pyexcel-io","tags":["data processing","excel","csv","io","spreadsheet","tabular data"],"install":[{"cmd":"pip install pyexcel-io","lang":"bash","label":"Install pyexcel-io"}],"dependencies":[{"reason":"Required for reading 'csvz' and 'tsvz' formats. Moved to optional since v0.6.7.","package":"chardet","optional":true}],"imports":[{"symbol":"get_data","correct":"from pyexcel_io import get_data"},{"symbol":"save_data","correct":"from pyexcel_io import save_data"}],"quickstart":{"code":"import os\nfrom pyexcel_io import save_data, get_data\nfrom io import StringIO\n\n# --- Writing data to a virtual CSV file (StringIO) ---\ndata_to_write = [\n    [\"Name\", \"Age\", \"City\"],\n    [\"Alice\", 30, \"New York\"],\n    [\"Bob\", 24, \"London\"]\n]\n\noutput_stream = StringIO()\nsave_data(output_stream, data_to_write, file_type='csv')\n\n# Simulate getting content from the stream\noutput_stream.seek(0)\ncsv_content = output_stream.getvalue()\nprint(\"Generated CSV content:\\n\" + csv_content)\n\n# --- Reading data from the virtual CSV file (StringIO) ---\ninput_stream = StringIO(csv_content)\n# get_data returns a dictionary where keys are sheet names (or 'csv' for single file)\ndread_data = get_data(input_stream, file_type='csv')\n\n# Access the first (and only) sheet, usually named 'csv'\nif 'csv' in dread_data:\n    print(\"\\nRead data:\")\n    for row in dread_data['csv']:\n        print(row)\nelse:\n    print(\"Error: Could not read data from CSV stream.\")\n\n# Example with a physical file (uncomment to test locally)\n# file_name = \"example.csv\"\n# save_data(file_name, data_to_write)\n# data_from_file = get_data(file_name)\n# print(f\"\\nData from {file_name}: {data_from_file[file_name]}\")\n# os.remove(file_name) # Clean up","lang":"python","description":"This quickstart demonstrates how to use `pyexcel-io` to write tabular data to a virtual CSV file (using `StringIO`) and then read it back. The core functions `save_data` and `get_data` provide a unified interface for various data sources and formats."},"warnings":[{"fix":"Upgrade to Python 3.6 or newer, or use pyexcel-io versions lower than 0.6.0 if Python 2 or older Python 3 is necessary.","message":"Pyexcel-io v0.6.0 dropped support for Python 2 and older Python 3 versions (3.3, 3.4, 3.5). Python 3.6+ is now required.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Update existing plugins or develop new ones conforming to the new plugin interface. Review PyInstaller documentation for updated packaging instructions.","message":"The plugin interface was completely rewritten in v0.6.0, making plugins developed for older versions (e.g., v0.3.x) incompatible. This also impacts PyInstaller users requiring updated configurations.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"If reading `csvz` or `tsvz` formats, explicitly install `chardet`: `pip install chardet`.","message":"The `chardet` library, previously an implicit dependency for `csvz` and `tsvz` readers, became optional in v0.6.7. If your application relies on these formats, you may need to install `chardet` explicitly.","severity":"gotcha","affected_versions":">=0.6.7"},{"fix":"Upgrade to pyexcel-io v0.6.7 or newer. If upgrading is not possible, avoid dots in filenames or provide a file-like object instead.","message":"In versions prior to 0.6.7, pathnames containing dots ('.') could cause `file_name` errors when using `get_writer`.","severity":"gotcha","affected_versions":"<0.6.7"},{"fix":"Explicitly specify the desired plugin using the `library` parameter in `get_data` or `save_data` (e.g., `get_data(..., library='pyexcel-odsr')`), or uninstall the unwanted overlapping plugin.","message":"When multiple pyexcel plugins (e.g., `pyexcel-ods` and `pyexcel-odsr`) are installed that support the same file format, `pyexcel-io` might pick one unpredictably. This can lead to unexpected behavior or an error.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Users needing to preserve such formatting or handle protected files should consider alternative libraries or pre-process/post-process files outside of pyexcel-io.","message":"Pyexcel-io specifically focuses on tabular data; it does not support reading or writing fonts, colors, charts, images, or password-protected Excel files.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For optimal memory usage with large files, prefer CSV format or plugins explicitly designed for streaming (e.g., `pyexcel-xlsxr`).","message":"While pyexcel-io supports 'streaming' for large files, many underlying plugins for formats like XLS, XLSX, and ODS (e.g., `pyexcel-xls`, `pyexcel-xlsx`, `pyexcel-ods`) still load the entire file into memory due to their zipped XML structure. Only `csv` readers, `pyexcel-xlsxr`, `pyexcel-odsr`, and `pyexcel-htmlr` truly support partial/streaming reads for memory efficiency.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'activ':51 'api':13 'chart':48 'csv':24,60 'data':19,42,57,64 'databas':35 'django':37 'excel':59 'extens':27 'file':22 'focus':40 'font':46 'format':23,45 'frequent':54 'io':2,5,61 'librari':9 'like':28 'maintain':52 'minor':55 'model':38 'od':31 'plugin':33 'process':43,58 'provid':10 'pyexcel':1,4 'pyexcel-io':3 'python':8 'read':15 'releas':56 'spreadsheet':62 'sqlalchemi':36 'structur':18 'tabular':63 'tsv':25 'unifi':12 'various':21 'via':32 'write':17 'xls':29 'xlsx':30","created_at":"2026-04-11T01:38:32.332394+00:00","updated_at":"2026-04-16T18:26:43.591650+00:00","problems":[{"fix":"Install the required plugin using pip. For example, to read or write XLSX files, run `pip install pyexcel-xlsx`.","cause":"Pyexcel-io itself only handles basic CSV/TSV formats; for other file types like XLS, XLSX, or ODS, it relies on external plugins (e.g., `pyexcel-xlsx`, `pyexcel-xls`, `pyexcel-ods`) which must be explicitly installed.","error":"pyexcel_io.exceptions.SupportingPluginAvailableButNotInstalled: Please install one of these plugins for read data in 'xlsx': pyexcel-xls,pyexcel-xlsx"},{"fix":"Verify the file path and filename are accurate, including the correct file extension. Ensure the file exists in the specified location, or use an absolute path to the file.","cause":"The file specified in the `pyexcel-io` operation (e.g., `get_data`, `save_data`) does not exist at the provided path, or the path/filename is incorrect.","error":"FileNotFoundError: [Errno 2] No such file or directory"},{"fix":"Explicitly include the necessary `pyexcel` plugins in your PyInstaller command using `--hidden-import`. For example: `pyinstaller your_script.py --hidden-import pyexcel_xlsx --hidden-import pyexcel_xls`.","cause":"When packaging an application with PyInstaller, the lazy-loading nature of `pyexcel-io`'s format-specific plugins means PyInstaller might not automatically detect and include them in the bundled executable, leading to runtime errors when trying to access those formats.","error":"(Often manifests as 'pyexcel_io.exceptions.SupportingPluginAvailableButNotInstalled' at runtime from a PyInstaller executable)"},{"fix":"Ensure that the data structure passed to the writing function is a dictionary where keys are sheet names (strings) and values are the sheet's data (e.g., a list of lists). If you have a single sheet, wrap it like `{'Sheet1': your_list_of_lists}`.","cause":"This error occurs when a function that expects a dictionary of sheet names to data (e.g., `{'Sheet1': [[1,2],[3,4]]}`) receives a plain list of lists (e.g., `[[1,2],[3,4]]`) instead, particularly when trying to save data to a multi-sheet-capable format.","error":"AttributeError: 'list' object has no attribute 'keys'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.6.8","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/pyexcel/pyexcel-io","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pyexcel-io/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization","database"],"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}}