You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Octave调用xlsread出现Unzip failed with error 9错误求助

Fixing Octave xlsread "Unzip failed with error 9" for .xlsm Files

Hey, let's work through this error you're facing when using xlsread on a .xlsm file in Octave. I've dealt with similar unzip-related issues with Office Open XML files before, so here are practical solutions to try:

  • Verify file existence, path, and integrity

    • First, confirm the file is in Octave's current working directory. Run pwd to check your current path, then dir to see if file.xlsm is listed. If not, either move the file to that directory or use the full absolute path in xlsread, like:
      xlsread('/Users/yourname/Documents/file.xlsm','Sheet')
      
    • This error often pops up if the .xlsm file is corrupted. Try opening it directly in Excel—if Excel can't read it or prompts for repair, you'll need to fix the file (use Excel's repair tool) or get a fresh copy.
  • Ensure unzip tool is installed and io package is up-to-date

    • Octave's io package relies on system-level unzip to parse .xlsm/.xlsx files. Check if unzip is available by running this in Octave:
      system('unzip --version')
      
      If it returns an error, install unzip:
      • Windows: Install 7-Zip and add its bin folder to your system PATH, or use Git Bash's unzip.
      • Linux: Use your package manager (e.g., sudo apt install unzip for Debian/Ubuntu).
      • macOS: If not pre-installed, run brew install unzip (requires Homebrew).
    • Update your io package to the latest version—old versions have compatibility gaps with newer .xlsm files:
      pkg update io
      
  • Try alternative file formats or functions

    • .xlsm files contain macros, which can affect their zip structure. Save the file as a regular .xlsx in Excel (File > Save As > Excel Workbook (*.xlsx)), then run xlsread on the new file.
    • Use Octave's readtable function (part of the io package) instead—it has better support for modern Excel formats:
      data_table = readtable('file.xlsm', 'Sheet', 'Sheet');
      
      You can then extract data from the table using standard indexing, like data_table.Column1.
  • Check file permissions

    • Make sure Octave has read access to the file:
      • Windows: If the file is in a protected folder (e.g., C:\Program Files), launch Octave as Administrator.
      • Linux/macOS: Run chmod +r file.xlsm in the terminal to grant read permissions.

Hope one of these steps resolves the unzip error for you!

内容的提问来源于stack exchange,提问作者user2960842

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:10:51