Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6168919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:46:13+00:00 2026-05-23T22:46:13+00:00

is that possible to extract out all the data in second sheet from each

  • 0

is that possible to extract out all the data in second sheet from each of the excel file into new excel file? mean that i have a huge excel files in a folder, i would like to extract out all the second sheet from each of the excel file into new excel file. The sheet name is not the same.

fns = dir('*.xls');
for i = 1:length(fns)
s=xlsread('fns(i).name', 2); %read second sheet for each .xls file
xlswrite('newfile.xls'); %write the second sheet to newfile.xls
end

I have problem with the code i wrote above. anyone can help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:46:13+00:00Added an answer on May 23, 2026 at 10:46 pm

    Consider the following structure of files:

    in\
    |__ Book1.xls
    |__ Book2.xls
    

    Here is an example where we read the second sheet from each XLS file in the directory in, and write them all out as sheets to a new file out.xls in the current folder:

    dirName = 'c:\path\to\in';
    files = dir( fullfile(dirName,'*.xls') );
    files = {files.name}';                    %'
    
    SHEET_NUM = 2;
    for i=1:numel(files)
        [~,~,rawData] = xlsread(fullfile(dirName,files{i}), SHEET_NUM);
        xlswrite('out.xls', rawData, i);
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to extract data from a DB2 table, run some processing on each
Is it possible to extract all of the VBA code from a Word 2007
Is that possible to switch an Open Source Project license from GPL to LGPL
Is that possible? I mean, can both ends of the many to many relationship
Can anyone tell me if its possible to extract the linq2sql generated classes into
I have a script to extract certain data from a much bigger table, with
Is this possible to extract mantissa and exponent from a float in major R6RS
I need to extract a few fields of data from many lines of text.
I have a Zip archive with a large (important) file that will not extract.
I have a file that I only want to extract cells B9, B19, B29,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.