Clear Filters
Clear Filters

Extracting the row values from various sheets of excel file using actxserver

5 views (last 30 days)
Hi,
I have an excel file with 10 sheets and data in each sheet will increase as it gets updated. The number of columns remains the same(which is 10). The number of rows increases because it is dependent on the number of participants. I need to extract the values from every row of each sheet and write in a separate sheet so that the analysis gets easier.
I have done it using the conventional xlsread() and xlswrite command but it takes longer time when the number of rows increases. I tried using actxserver() and have following problems/queries:
  • Is there any detailed documentation about the actxserver(),because i do not understand all the methods used in actxserver and from where did they come from (e.g Workbook.open,Active Workbook.Sheets etc)?
  • So far I have written the code as :
clc
clear
filename = 'C:\Users\Tanmay Nath\Desktop\emotion.xls';
emotion = actxserver('Excel.Application');
emotion.Visible=0;
Workbook_emotion = emotion.Workbooks.Open(filename);
eSheets = emotion.ActiveWorkbook.Sheets;
eSheet1 = eSheets.Item(1);
eSheet1.Activate;
Range=eSheet1.Range('A1:J1');
Data=Range.Value
xlswrite1('C:\Users\Tanmay Nath\Desktop\test.xlsx',Data,'Sheet1','A1:J1')
emotion.Save();
emotion.Quit();
i checked this link to http://www.mathworks.com/matlabcentral/answers/18306-how-to-import-data-to-excel-through-matlab to use the xlswrite1 function, but it gives me error
??? Error using ==> evalin
Undefined function or variable 'Excel'.
Error in ==> xlswrite1 at 2
Excel=evalin('base','Excel');
So can anyone please help me so that i can read my excel sheets one by one and extract the rows from every sheet and write in another sheet using actxserver.
Also, since the number of rows increases, so i need any update kind of function,so that when i run the code, it need not have to process the entire sheet again and it processes only the new entry.
Please help
Thanks

Answers (1)

Image Analyst
Image Analyst on 17 Jun 2012

Tags

Community Treasure Hunt

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

Start Hunting!