File Exchange

image thumbnail

xlsheets

version 1.0.0.0 (2.77 KB) by Fahad Al Mahmood
Creating sheets and naming them in Excel.

5 Downloads

Updated 01 Oct 2004

View License

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);

Cite As

Fahad Al Mahmood (2021). xlsheets (https://www.mathworks.com/matlabcentral/fileexchange/4474-xlsheets), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (12)

hao chao

Thanks a lot!

abderrazak chahid

Thank you very much.

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.

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

Tina Tseng

Andrew Wilson

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

Exo Sceleton

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

bean bean

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 ?

Gourihar Kulkarni

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

Udya Desai

Rashid Al mannai

Very useful program

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!