How to save the edited value inside the excel .xlsx file?

5 Ansichten (letzte 30 Tage)
Hello guys,
In my app, I am loading a .xlsx file, allowing the user to change some parameters. I figured out how to change the parameters in the app and store them in the app. Now I want the changed variables saved in excel as the following.
  1. Save should overwrite the .xlsx file.
  2. Save as should let the user save a new file of .xlsx.
Like when you write on a word doc, you can save your edited text in the same .doc file or a new .doc file. How can I do the code or a command to save and save as in .xlsxusing the buttons?

Akzeptierte Antwort

Kevin Holly
Kevin Holly am 15 Feb. 2023
Please see app attached.
I added filename as a property variable and then added the following:
For the Save callback, I added:
% Save
writetable(app.UITable.Data,fullfile(app.folder,app.filename))
For the Save as callback, I added:
[app.filename, app.folder] = uiputfile('*.xlsx');
writetable(app.UITable.Data,fullfile(app.folder,app.filename))

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by