MATLAB Answers

Can't read excel file using readtable and detectImportOptions after compiling the App. It works perfectly fine in the test environment

조회 수: 5(최근 30일)
Peeyush Pankaj
Peeyush Pankaj 2021년 5월 21일
답변: Marius Mueller 2021년 7월 21일
I have created an app using App Designer in 2021a. All the functionalities work well in the test environment. However, when I compile the app either as a standalone executable or a WebApp server, it fails to read the excel file that I'm uploading into the app. Below are the things that I've already tried:
  1. Using full filepath and file name in readtable
  2. Instead of uploading a an excel spreadsheet, I tried defining the path and filename as hard code in the app
Below is the screenshot from the WebApp log. It seems that the spreadsheet is not readable. I've also given link to access my entire application and the sample spreadsheets: Application and Files
  댓글 수: 1
dpb 2021년 5월 21일
NB: the warning "Using Excel is not recommended for web apps"
I'd guess there's the root of the problem in that it doesn't have access to Excel runtime.
I've been building a coded app that also reads/writes Excel spreadsheets, but it's running on the local machine, not over the web, and it works just fine either as compiled or in test/development environment.
Also note it says it "Unable to open .... as a workbook" not that the file isn't found.

댓글을 달려면 로그인하십시오.


Marius Mueller
Marius Mueller 2021년 7월 21일
I have the exact same issue.
Everything was peachy in R2020b but once i switched to R2021a this error occurs.
I could not find any related information in the release notes.
Does anyone know of a workaround when the input format has to be excel?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by