1

i am importing some Excel coloumns, what perfectly works. Unfortunatly i am current setting the range Range [2, 50] statically

import = Import["/Users/Tool/Import.xls", {"Data", 2, Range [2, 50], {4, 5}}]

is there a way to set up this dynamically. Just the number of the rows. The coloumns are fixed in {4, 5}

many thanks

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
  • Please format the code in your questions appropriately. Learn here how to do that. – Sascha Aug 21 '16 at 09:53
  • @Sascha: Thanks. Done – Melanie Gerster Aug 21 '16 at 10:04
  • Just replace Range[2,50] with 'All'. See duplicate here: http://mathematica.stackexchange.com/q/71635/6588 – Quantum_Oli Aug 21 '16 at 10:14
  • Sorry, but All will not work due i start with row = 2. I know that duplicate and sorry for asking again but i have already coded it and found it out – Melanie Gerster Aug 21 '16 at 10:15
  • 2
    Just remove the first row after having imported? See Rest: https://reference.wolfram.com/language/ref/Rest.html – Quantum_Oli Aug 21 '16 at 10:43
  • thanks. the issue is the different data format. But the best would be to manually update the row number. it is less effort as it i looks than all other things provided – Melanie Gerster Aug 21 '16 at 14:40
  • there really is no reason to use the Import options to select the range. Import the whole thing and use Part to save what you want. There is no performance or memory savings to do it via Import – george2079 Sep 20 '16 at 14:53
  • Is it the case columns 4 and 5 have fewer rows that the rest of the page or what? Please clarify what is your criteria for deciding how many rows to import. – george2079 Oct 20 '16 at 14:47

1 Answers1

0
istart = 2;
istop = 50;
import = Import[ "/Users/Tool/Import.xls", {"Data", 2, Range [istart, istop], {4, 5}}]

?

Quantum_Oli
  • 7,964
  • 2
  • 21
  • 43
  • ok but how to calculate the istop ? :) That is the key issue i have. I would like to calculate this by run-time if it would be possible – Melanie Gerster Aug 21 '16 at 09:55
  • Depends what you want to set it to! I assume now that you want to set it to the value of the last row containing an entry in your xls? (You've not actually stated that anywhere) – Quantum_Oli Aug 21 '16 at 10:10
  • I'm confused… doesn't Mathematica only import up to the rightmost column and lowest row that contains something? – J. M.'s missing motivation Aug 21 '16 at 12:08