How to name an excel worksheet when using writetable
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
2 개 추천
Is there a simple way to name an the excel worksheet when using the writetable fnx? I am aware of the answer by Thomas Koelen on 8 May 2015 ( https://www.mathworks.com/matlabcentral/answers/215703-changing-the-name-of-the-sheet-in-excel ) but I am hoping there is a more direct and simple method, not involving ActiveX. Instead of an excel workbook with "Sheet1", "Sheet2", etc I want to give specific names to the worksheets.
채택된 답변
Fangjun Jiang
2017년 7월 21일
writetable(TableObj,'test.xlsx','FileType','spreadsheet','Sheet','MyTable')
댓글 수: 8
Stephen
2017년 7월 21일
편집: Walter Roberson
2022년 7월 9일
Thanks, Fangjun Jiang! Worked great with one caveat: I modified your script slightly to (note the quotation marks):
writetable(TableObj,'test.xlsx','FileType','Sheet',"MyTable")
This indeed names the worksheet, but it ADDS this sheet to an excel workbook such that I now have sheet1, sheet2, and then "MyTable".
Is there a way to get prevent the appearance of sheets 1 and 2...it just is messy. Of course I can delete them in Excel, but I'm looking for a streamlined way of creating the excel workbook.
Fangjun Jiang
2017년 7월 21일
편집: Fangjun Jiang
2017년 7월 21일
I can't think of anything if you don't want to involve ActiveX. One last resort yet not ideal is that you create a template Excel file ahead of time. This template Excel file only contains one sheet which you can put some useful notes and comments. Write to this template Excel file by creating a new sheet every time. Or, you can even over-write this one pre-existing sheet.
Got it. Thanks. I'm set now. I appreciate your help!
Hi Stephen, did you solve your problem with 3 additional empty Excel sheets? Could you explain me how you did it exactly? I would really appreciate it!
The code allows writing data on the specified, named tab. However, it pushed the tab to the last tab and leaving Sheet 1, Sheet 2, and Sheet 3 in front of the data tab created. This is a problem for later use of collecting data. I could not find any way to delete Sheet 1, Sheet 2, Sheet 3 either. Did anyone solve this issue?
Seum Bin Rahman
2019년 10월 11일
편집: Walter Roberson
2022년 7월 9일
Hastyar Barvar comments to @Seum Bin Rahman
irreverent and sensing for a downlink
Hastyar Barvar:
The topic of the link is how to get rid of the default three sheets that are created, 'sheet1', 'sheet2', 'sheet3' . Deleting those sheets after creation is a valid approach to the question of how to end up with an Excel worksheet that does not have sheets with those names, which is what @Stephen was asking about.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
