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

6 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by