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

5 views (last 30 days)
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?

Accepted Answer

Kevin Holly
Kevin Holly on 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))

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!