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 8264443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:27:32+00:00 2026-06-08T04:27:32+00:00

I have two excel files each with a single worksheet. I want to take

  • 0

I have two excel files each with a single worksheet. I want to take the two excel files and create a single excel file with two worksheets. I would like to do this with PHP. Can anyone point me in the right direction?

  • 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-06-08T04:27:34+00:00Added an answer on June 8, 2026 at 4:27 am

    Using PHPExcel

    $inputFileType1 = 'Excel2007';
    $inputFileName1 = 'inputData1.xlsx';
    $inputFileType2 = 'Excel5';
    $inputFileName2 = 'inputData2.xls';
    $outputFileType = 'Excel5';
    $outputFileName = 'outputData.xls';
    
    // Load the first workbook (an xlsx file)
    $objPHPExcelReader1 = PHPExcel_IOFactory::createReader($inputFileType1);
    $objPHPExcel1 = $objPHPExcelReader1->load($inputFileName1);
    
    // Load the second workbook (an xls file)
    $objPHPExcelReader2 = PHPExcel_IOFactory::createReader($inputFileType2);
    $objPHPExcel2 = $objPHPExcelReader2->load($inputFileName2);
    
    // Merge the second workbook into the first
    $objPHPExcel2->getActiveSheet()->setTitle('Unique worksheet name');
    $objPHPExcel1->addExternalSheet($objPHPExcel2->getActiveSheet());
    
    // Save the merged workbook under a new name (could save under the original name)
    // as an xls file
    $objPHPExcelWriter = PHPExcel_IOFactory::createWriter($objPHPExcel1,$outputFileType);
    $objPHPExcelWriter->save($outputFileName);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two excel files. The first excel file is like this: 12 A
I have two lists of names in Excel '07. Two columns in each file:
I have two excel files. First excel file contains the Person Name and Total
I have an excel file with some email links. I would like to have
I have two excel files. Among many columns in both these files, they have
I have two Excel files contains the following structure, EmployeeAllDtl.xlsx id email name age
I have an excel file (that I use as a template) with two rows.
I have a Excel sheet with two columns and I need to create new
I have two columns of integers between 1 and 16 in an excel file.
I have two separate Excel files containing an old and a new electrical plant

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.