how to append row in excel sheet

조회 수: 51 (최근 30일)
akshay dua
akshay dua 2016년 4월 6일
댓글: Cris LaPierre 2022년 6월 10일
hi everyone i am trying to use xlswrite to store value of some variable in excel sheet in one program And when i try to update same excel sheet to add another row of data from other program in same excel sheet it is giving error,can anybody suggest me any method ??
  댓글 수: 2
Muhammad Usman Saleem
Muhammad Usman Saleem 2016년 4월 7일
And when i try to update same excel sheet to add another row of data from other program in same excel sheet it is giving error
Not understand these lines?
akshay dua
akshay dua 2016년 4월 8일
hi!! what i mean from above line is i am storing my data of one program in excel sheet using xls command but what i want to know is how can i use same excel file that i created for previous data to store data of second program and keeping data of first program in that same file,,or in other word how can i add another row of data in excel sheet that is already created

댓글을 달려면 로그인하십시오.

답변 (2개)

Muhammad Usman Saleem
Muhammad Usman Saleem 2016년 4월 6일
xlmwrite('YourfileName',value,'append')
  댓글 수: 3
Muhammad Usman Saleem
Muhammad Usman Saleem 2016년 4월 7일
For storing data into excel file
>> data=rand(5,2) % creating a random matix
%storing this matrix into 3 sheet of excel file
sheet=3;
%Here i am storing data into excel file of NameOfYourFile
xlswrite('NameOfYourFile',data,sheet,'F1')
%F1 is the cell no where this matrix stor in excel
data =
0.3111 0.9797
0.9234 0.4389
0.4302 0.1111
0.1848 0.2581
0.9049 0.4087
I try this in matlob r2013. Excel file which created this code has attached with this answer

댓글을 달려면 로그인하십시오.


Cris LaPierre
Cris LaPierre 2019년 1월 4일
Look at the documentation for xlswrite:
  • xlswrite(filename,A) writes matrix A to the first worksheet in the Microsoft® Excel® spreadsheet workbook filename starting at cell A1.
You can use the xlRange input to somehow specify what row to write the data to. This would require keeping track of what row you last wrote to. Or first reading in the file to determine how many rows have already been written.
  • xlswrite(filename,A,xlRange) writes to the rectangular region specified by xlRange in the first worksheet of the workbook. Use Excel range syntax, such as 'A1:C3'.
An alternative is to use the user-submitted function xlsappend, available on the file exchange.
  댓글 수: 2
Satish
Satish 2022년 6월 10일
I have excel sheet i need to append the data inthe middle of excel sheet. Any one please help me
Cris LaPierre
Cris LaPierre 2022년 6월 10일
By definition, that is not appending.
You will likely need to rewrite all the information from the insertion point to the end of that sheet to get the data organized the way you want.
My approach would likely be to load all the data by the page, then incorprate the data where I want it, then rewrite all the data to the sheet.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by