1
$\begingroup$

I'm attempting to extract a sheet in an Excel file which consists of multiple sheets. How do I instruct Mathematica to extract a specific page?

Any help is appreciated.

Thanks in advance.

$\endgroup$
2

1 Answer 1

1
$\begingroup$

This stub might be helpful to you. I don't typically set all the variables like this, but I'm trying to make it all clear.

sheetI=1;
colI=4;
startRowI=2;
endRowI = 69;
impS="path/filename";
retL = Import[impS, {"Data", sheetI, Table[i, {i, startRowI, endRowI}], colI}]

This will extract rows from 2 to 69 of the fourth column in the first sheet. You can replace the colI with a list if you want more than one column.

Naturally you need a valid impS that points to your file. I use the following stub for that, and keep my data in a directory "one up and one down" from the notebook directory. I keep the extension separate because I go back and forth between xls, xlsx, and csv formats depending upon what I'm doing

searchS =  "../Curated Data";
nameS = “/replace_with_file_name_to_import";
extS = ".csv";
impS = searchS <> nameS <> extS
$\endgroup$

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