Code covered by the BSD License  

Highlights from
xlsheets

4.25

4.2 | 8 ratings Rate this file 9 Downloads (last 30 days) File Size: 2.77 KB File ID: #4474
image thumbnail

xlsheets

by Fahad Al Mahmood

 

12 Feb 2004 (Updated 01 Oct 2004)

Creating sheets and naming them in Excel.

| Watch this File

File Information
Description

Creates new Excel file (or opens it if file exists) and name the sheets as listed in (sheetnames) and saves the workbook as (filename).

xlsheets(sheetnames,filename)
xlsheets(sheetnames)

sheetnames: List of sheet names (cell array).
filename: Name of excel file.

NOTE: Follow the following rules when naming your sheets:
1- Make sure the name you entered does not exceed 31 characters.
2- Make sure the name does not contain any of the following characters:
: \ / ? * [ or ]
3- Make sure you did not leave the name blank.
4- Make sure each sheet name is a character string.
5- Make sure you do not have two sheets or more with the same name.

Example:

sheetnames = {'Mama','Papa','Son','Daughter','Dog'};
filename = 'family.xls';
xlsheets(sheetnames,filename);
xlsheets(sheetnames);

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
xlswrite
This submission has inspired the following:
Example of how to save or read data to an Excel archive.

MATLAB release MATLAB 6.5 (R13)
Other requirements Microsoft Excel
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
14 Feb 2004 Rashid Al mannai

Very useful program

29 Apr 2004 Udya Desai  
03 May 2004 Gourihar Kulkarni

An extraordinary .m file. I appreciate
your contribution to scientific community.
Many thanks.

30 Sep 2004 avi pinsker

Thak you very much, very usefull a program.
only one problem:
Invoke Error, Dispatch Exception: An attempt was made to load a program with an incorrect format
how do I fix this ?

17 Mar 2006 bean bean  
16 Apr 2007 Exo Sceleton

Thank you for your sharing mentality.
Just the lines of code i needed.

24 Sep 2008 Andrew Wilson

Works perfectly and solves a problem for me. The work is much appreciated.

09 Oct 2009 Tina Tseng  
28 Jun 2010 Andrew Wilson

A recent update has altered the way this function works (I'm not sure if it's a Matlab or Excel update, I suspect the latter); Excel files created with this function now produce a warning when opened in Excel that asks whether the file is legitimate. Ignoring the error and re-saving the Excel file solves the issue, but I was wondering if you could update the function to handle this.

Thanks! I still use this function all the time!
-andrew

14 Jul 2011 Andrew Wilson

I've found the problem I mentioned in my last comment:

http://support.microsoft.com/kb/948615

It's by design and you can't easily avoid it. Creating .xlsx files, instead of .xls files, works fine and doesn't trigger the error.

Please login to add a comment or rating.
Updates
17 Feb 2004

Open exisiting file feature added

17 Feb 2004

Open exisiting file feature added

17 Feb 2004

Important Note Added to (help) in addition to more descriptive (in-program) documentation.

27 Feb 2004

Fixed [Group] problem + Making process invisible

01 Mar 2004

Fixed "replacing existing sheets" problem

16 Mar 2004

Fixed (filename) problem

05 Apr 2004

Fixed (Naming to an existing sheetnames + Opening Multiple Excel programs) Problems

17 May 2004

Added more help about the rules of naming Excel sheets

01 Oct 2004

Supporting Full or Partial Path

Tag Activity for this File
Tag Applied By Date/Time
data import Fahad Al Mahmood 22 Oct 2008 07:14:18
data export Fahad Al Mahmood 22 Oct 2008 07:14:18
excel Fahad Al Mahmood 22 Oct 2008 07:14:18
activex Fahad Al Mahmood 22 Oct 2008 07:14:18
spreadsheet Fahad Al Mahmood 22 Oct 2008 07:14:18
xls Fahad Al Mahmood 22 Oct 2008 07:14:18
utilities Fahad Al Mahmood 22 Oct 2008 07:14:18

Contact us at files@mathworks.com