Info

This question is closed. Reopen it to edit or answer.

how to copy sheet from one excel to another sheet of excel.

1 view (last 30 days)
This question was flagged by dpb
Hello
I tried below code
excelFile1 = fname; --> It is having Excel file format data with .xlsx extension
excelName1 = fullfile(newPath,excelFile1);
excel = actxserver('Excel.Application');
Workbooks = excel.Workbooks;
wbsource = Workbooks.Open(excelName);
wbdest = Workbooks.Open(excelName1);
ws = wbsource.Worksheets.Item(newidx); ---> here newidx will be having sheet name from OLD excel.
ws.Copy(wbdest.Worksheets.Item(1)); ----> error at this line
wbdest.Save %save destination workbook
excel.Quit
Error:
Dot indexing is not supported for variables of this type.
Error in IncDecAnalysis (line 58)
ws.Copy(wbdest.Worksheets.Item(1));
I have seen few of documents but could not find solution.
Thank you

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!