Overwrite an existing excel file (multiple sheets)
4 次查看(过去 30 天)
显示 更早的评论
Hi everyone!
I have imported an Excel file with N=20 sheets.
Each sheet contains two coloumns.
I create two cell arrays, Cf, Ci in the figure.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/846290/image.png)
The following figure shows how each cella array is made.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/846295/image.png)
Finally, the following figure shows how each table is made (in particular, Var1 e Var2 of Ci correspond to the 2 coloumn of esch excel sheet).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/846300/image.png)
I would like to:
- add Var1 and Var2 of Cf to each table of Ci;
- overwrite the existing excel file with the modified sheets --> each sheet will have two coloumn corresponding to Ci and two coloumns corresponding to Cf.
Do you have any suggestion?
Thank you in advance!
1 个评论
Stephen23
2021-12-28
"Do you have any suggestion?"
Do NOT use the variable name DIR, because this will shadow the very important inbuilt DIR function.
采纳的回答
Image Analyst
2021-12-28
You can call xlswrite() or writetable() one sheet at a time. It should add the new sheets and retain the existing sheets.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!