Copy XLS Sheet

16 ビュー (過去 30 日間)
Bill Rooker
Bill Rooker 2011 年 10 月 18 日
回答済み: Pruthvi G 2019 年 9 月 30 日
Hello everyone,
Is there a way to copy an existing XLS sheet using Matlab? I have a template sheet that I would like to use when writing data. Since I have multiple data tables that use the same template, I would like the ability to have Matlab copy (and rename) the sheet and then write the data.
The template sheet would have the column names and have the columns formatted. I would simple write out the data.
Can this be done?
Thank you for any assistance.
Best regards,
Bill Rooker
  2 件のコメント
Fangjun Jiang
Fangjun Jiang 2011 年 10 月 18 日
Do you want to write the data into the same file with different sheet names, or write to the different .xls file names (also with different sheet names)?
Bill Rooker
Bill Rooker 2011 年 10 月 19 日
Hello,
Ideally, I would want to write the data into the same file with different sheet names. However, I don't mind having a template file that is used to write to a different file (also with different sheet names). Is there a way to do this?
Thanks,
Bill Rooker

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2011 年 10 月 19 日
Yes, I'm sure it can be done with ActiveX. Look at my ExcelDemo: http://www.mathworks.com/matlabcentral/answers/18306-how-to-import-data-to-excel-through-matlab It shows you how to use ActiveX. I'm not exactly sure how to copy a sheet, but with my example of other Excel commands, and you looking up the proper method on the Microsoft Office Developer's web site (which you can do just as well as I can), you can do it. The Excel 2007 developer's web site is http://msdn.microsoft.com/en-us/library/bb242656%28office.12%29.aspx Look through that and eventually you'll find either the command to duplicate a sheet, or else you can just select a range (which my demo shows you how to do), and copy the data, then add new worksheet (again, in my demo), paste, and save the workbook (again, in my demo). Good luck.

その他の回答 (1 件)

Pruthvi G
Pruthvi G 2019 年 9 月 30 日

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by