Exported formulas on excel sheets resulted in text which would not be evaluated automatically

16 次查看(过去 30 天)
According to the past post, simply using xlswrite and writecell to export formula as text (char/string) will result in formulas in Excel.
However executing the following on R2019a, Windows 10.
a={'1','2','=sum(a1,b1)'}
a(2,:)={'4' '5' '=sum(a2,b2)'}
a(3,:)={4, 5 ,'=sum(a3,b3)'}
% xlswrite('Book.xls',a)
writecell(a,'Book.xls')
creates the following.
Do we need any set-up on Excel side or is there anything that can be done from MATLAB side? Using ActiveX is of course an option, but I'm looking for simpler option.

采纳的回答

Walter Roberson
Walter Roberson 2019-10-18
That post does not say that the formulas will be executable once written by xlswrite.
None of the table based operations such as writetable or writecell are able to create executable formulas. You will need to use ActiveX methods.
  7 个评论
michio
michio 2019-10-28
Setting 'UseExcel' to true resolves the issue with writecell.
a={'1','2','=sum(a1,b1)'}
a(2,:)={'4' '5' '=sum(a2,b2)'}
a(3,:)={4, 5 ,'=sum(a3,b3)'}
writecell(a,'Book.xls','UseExcel',true)
Alex Calder
Alex Calder 2022-11-2
So do I understand correctly, that there is no solution for environments without Excel installed? I have a managed Linux environment that uses Open Office, rather than Excel.

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by