# Importing a named range of cells from Excel

I have a macro (is that what you call it?) set up in Mathematica and it runs fine. What I want to do now is set up my notebook to look through an Excel document (.xlsx) and pick out a certain set of cells that I named in Excel using the name manager. How do I get Mathematica to import that Named Range?

Also I have noticed that Mathematica will not recognize every excel document and I have checked to make sure that the file is an xlsx file and still Mathematica tells me that the file can't be opened as an xls.

So two problems.

1. Mathematica doesn't accept every file name I give it and reports the it cannot be imported in XLS format.
2. How to I import a named cell from Excel without having to use row and column descriptors?

Per request here is what I have tried so far

Import["NajaK5uLData.xls"]


Import::nffil: File not found during Import. >>
$Failed Import[NotebookDirectory[] <> "NajaK5uLdata.xlsx"]  Import::fmterr: Cannot import data as XLS format. >>$Failed

-
Normally, Mathematica users don't call anything in Mathematica a macro. –  m_goldberg Jun 21 '13 at 13:32
Please edit your post to show the code you have tried so far. –  m_goldberg Jun 21 '13 at 13:33
Perhaps put your spreadsheet on a server where we can download it and see if one of us can load it into Mathematica. –  Michael Stern Jun 22 '13 at 15:16
It might be helpful if you could provide a link to a description of what named cell ranges are. Most of us are not Excel experts, and personally it's the first time I've heard of this. Since it sounds like it might be a new feature in Excel 2007, you should be aware that not all features of the XLSX format are fully supported so far. –  Oleksandr R. Jun 22 '13 at 20:22

I have never had a problem importing any kind of Excel file into modern versions of Mathematica. What version are you using? In version 9, this works:

illustration =
Import[NotebookDirectory[] <> "settlements-20130607ß.xlsm",
"Data"][[14]];


Note that it works for .xlsm files just as easily as it would for .xlsx or .xls. Also note that I can discard everything but a particular tab (tab 14 in this example), if I know the information I want is there.

In response to your second question, I do not believe there is any way to refer to Excel's named ranges from within Mathematica. Why not have an extra tab ("mathematica export" or whatever) in your Excel workbook, and then refer to your named range there in a known location. Mathematica can then import that tab and your data will be immediately on hand.

-
Well I am using version 8.0. I did think of just specifying a sheet and then a cell, I just thought it would have been clever if Mathematica could find cell names, plus I'd think it would be simpler since cell names are workbook and not Sheet specific. I tried using the NotebookDirectory but I didn't specify the file and it listed several files that I had. However, the one I was searching for did not appear on the list. Sorry I'm pretty new to this –  CouldntThinkOfAName Jun 21 '13 at 15:31
Thank you for your help but I think I am just got to create a text file and import from there. Sorry I couldn't adequately explain my problem. Once again thank you. –  CouldntThinkOfAName Jun 24 '13 at 11:50