Open an excel sheet after clicking a pushbutton in GUI
Show older comments
I would like to create a GUI so whenever I click the push-button (I called it OK), matlab creates an excel sheet based on an already prepared excel template. Thank you for your help.
% --- Executes on button press in OK_.
function OK__Callback(hObject, eventdata, handles)
% hObject handle to OK_ (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Accepted Answer
More Answers (2)
Walter Roberson
on 14 Jun 2016
1 vote
Fetch the template, get() any necessary properties from the uicontrols and use the values to update the copy of the template, then xlswrite() the appropriate file.
2 Comments
Michel
on 14 Jun 2016
Walter Roberson
on 15 Jun 2016
I'm afraid I need a more explicit question. thanks
Image Analyst
on 15 Jun 2016
Use copyfile():
copyfile(existingXLTemplateFileName, newWorkbookFileName);
If you then want to open it up in Excel, and you have Windows, do this:
winopen(newWorkbookFileName);
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!