MATLAB Answers

to write to a excel file

1 view (last 30 days)
Sajid Afaque
Sajid Afaque on 26 Mar 2019
Answered: Raghunandan V on 27 Mar 2019
hi ,
i have enclosed my code below. i am able to read and write to excel file, but the problem is i am able to write only when the excel file is closed.i am not able to read or write when the excel file is open.kindly help
d = {getenv('username') , date , datestr(now, 'HH:MM PM')};
[~, user_id] = xlsread('C:\Users\AFQ1KOR\Desktop\newfolder\kkr.xlsx','A:A');
access = ismember(getenv('username') , user_id );
if access == 1
[~, record] = xlsread('C:\Users\AFQ1KOR\Desktop\newfolder\Book11.xlsx','A:A');
q = size(record, 1);
r = q + 1;
xlswrite('C:\Users\AFQ1KOR\Desktop\newfolder\Book11.xlsx', d,sprintf('A%d:C%d', r, r));
errordlg(' please contact sajid for more details','Access denied','modal')


Sign in to comment.

Answers (1)

Raghunandan V
Raghunandan V on 27 Mar 2019
There cannot be two users editing a file together. In this case you are one user if the excel is open and Matlab is the other user


Sign in to comment.

Sign in to answer this question.




Translated by