Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm importing data from Excel. It appears that the sheet number needed in the Import statement is taken from the order that the sheets appear in the open Excel file. I need to import 2 of the sheets from an Excel file. I'd like to do it via the names of the sheets, or at least by some attribute that won't change if I add or delete other sheets or re-order the existing sheets. Can this be done?

share|improve this question
2  
Yes, the XLSX documentation page tells you how. –  Sjoerd C. de Vries Aug 1 '13 at 13:49
    
I am embarrassed. I looked again and there it was. –  Mitchell Kaplan Aug 1 '13 at 21:10
add comment

1 Answer

up vote 4 down vote accepted
(*show all sheets*)
Import["D:\\allstuff.xls", "Sheets"]
{"portf", "notes", "calc", "xirr", "tx", "JTrade", "Yahoo"}

Import["D:\\stuff.xls", {"Sheets", "portf", 6}]
(*gets 6th row of sheet named "portf"*)

Leave off the 6 to get the whole sheet or say 6,2 to get one cell at 6,B.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.