-1
$\begingroup$

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?

$\endgroup$
9
$\begingroup$
(*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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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