Adding Data Already Existing Excel Sheets

Hi,
I created an excel file nade "DATA". There are seven different sheets in it and the firs one is "PAGE1". My code gives numerical data at the end. I want put this data into a spesific row and colomn in the already excisting "DATA" file "PAGE1" sheet. How can I do that?

2 件のコメント

darova
darova 2020 年 3 月 5 日
Do you want to append data? Or you already know where to write (row and column)?
Onur ALPAY
Onur ALPAY 2020 年 3 月 5 日
Already know row and column, like G8:G18. Some other cells was filled with other datas. I have attached an excel file. In this case I want put some data into empty cells (E3:E6).

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

 採用された回答

darova
darova 2020 年 3 月 5 日

0 投票

Try writematrix
writematrix(M,'Sample.xlsx','Sheet',1,'Range','D3:D6')

4 件のコメント

Onur ALPAY
Onur ALPAY 2020 年 3 月 6 日
Thank you so much. It is solved. I have one more question.
I want to put a string expression into a cell like 'F1'. How can I do that?
darova
darova 2020 年 3 月 6 日
I don't have writematrix. I used xlswrite and cell
A = {'my string'}; % put string in cell
xlswrite('Sample.xlsx',A,'Sheet1','F1')
Moh. Saadat
Moh. Saadat 2020 年 4 月 27 日
Hi, is there any way I can append a row to an existing excel sheet without explicitly specifying the 'Range'?
For instance, I already have:
1 2
5 1
and I need to add another row with [0 3]: instead of using
writematrix(filename, var, 'Range', 'A3:B3');
I want something like
writematrix(filename, var, 'append')
The problem with specifying 'Range' is that the number of columns I will have in my variable is not fixed; that's why specifying the range explicitly becomes more complicated than it should be.
Thanks in advance!
darova
darova 2020 年 4 月 27 日
There is no append option. You can only read the whole matrix
Try this
A = readmatrix('data.xlsx','sheet',1); % read the whole matrix
A = [A; 0 3]; % append data
writematrix('data.xlsx','sheet',1) % write new matrix

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

その他の回答 (1 件)

Champuram Madhu
Champuram Madhu 2020 年 3 月 5 日

0 投票

You can refer here

1 件のコメント

Onur ALPAY
Onur ALPAY 2020 年 3 月 6 日
I have tried it first but i did not work.

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

質問済み:

2020 年 3 月 5 日

コメント済み:

2020 年 4 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by