Group Abstract Group Abstract

Message Boards Message Boards

1
|
2.3K Views
|
6 Replies
|
1 Total Like
View groups...
Share
Share this post:

How to skip lines and columns with Import

Posted 1 year ago
Attachments:
POSTED BY: Ehud Behar
6 Replies
Posted 1 year ago

Found an alternative that is more compact than my earlier suggestion:

Import["example-dataset.xlsx",{"Dataset",1,1;;16,{2,4}},"HeaderLines"->1]
POSTED BY: Hans Milton
Posted 1 year ago

Thanks very much! But do you think that SkipLines can be used to simply ignore the rest of the sheet? As I said in the question, SkipLines->17;;?

POSTED BY: Ehud Behar
Posted 1 year ago

It seems that it is not possible to use Span in the "SkipLines" option

POSTED BY: Hans Milton
Posted 1 year ago

Before trying to specify ranges to the SkipLines option, I think I first need to understand its usage.

Suppose I want to skip lines 5, 6 and 7.

Then why neither "SkipLines" -> {{5, 6, 7}} nor "SkipLines" -> {5, 6, 7} work?

By the way, see Rohit Namjoshi comment for a similar question I asked.

POSTED BY: Ehud Behar
Posted 1 year ago

The documentation for "SkipLines" refers only to ranges that start from the first line enter image description here

POSTED BY: Hans Milton
Posted 1 year ago

Try this to remove the unwanted lines:

ds=Import["example-dataset.xlsx",{"Dataset",1,All,{1,2,4}},"HeaderLines"->{1,1}][[1;;15]]

Getting rid of the first column:

Normal[ds] // Values // Dataset
POSTED BY: Hans Milton
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard