# Reading in non-consecutive columns using XLSX.gettable?

**URL:** <https://discourse.julialang.org/t/reading-in-non-consecutive-columns-using-xlsx-gettable/53060>\
**Category:** General Usage\
**Tags:** xlsx, io\
**Created:** [January 8, 2021, 8:08pm UTC](https://discourse.julialang.org/t/reading-in-non-consecutive-columns-using-xlsx-gettable/53060 "2021-01-08T20:08:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Barmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michael_barmann/32/20389_2.png) [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Post date:** [January 8, 2021, 8:08pm UTC](https://discourse.julialang.org/t/reading-in-non-consecutive-columns-using-xlsx-gettable/53060/1 "2021-01-08T20:08:07Z")

</div>

Is there a way to read in a selection of _non-consecutive_ columns of Excel data using `XLSX.gettable`? I’ve read the documentation here [Tutorial-XLSX.jl](https://felipenoris.github.io/XLSX.jl/stable/tutorial/#Read-Tabular-Data-1), but it’s not clear whether it’s possible to do this. For example,

`df = DataFrame(XLSX.gettable(sheet,"A:B")...)`

selects the data in columns “A” and “B” of a worksheet called `sheet`. But what if I want columns A and C, or B,E and F, for example? I tried

`df = DataFrame(XLSX.gettable(sheet,["A","C"])...)`

and similar variations of this, but it throws the following error: `MethodError: no method matching gettable(::XLSX.Worksheet, ::Array{String,1})`.

Is there a way to make this work with `gettable`, or is there a similar function which can accomplish this?

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [January 9, 2021, 8:17am UTC](https://discourse.julialang.org/t/reading-in-non-consecutive-columns-using-xlsx-gettable/53060/2 "2021-01-09T08:17:47Z")

</div>

Please make sure that you link to other places if cross-posting questions - I’ve given an answer on StackOverflow [here](https://stackoverflow.com/questions/65637945/reading-in-non-consecutive-columns-using-xlsx-gettable/65640654#65640654).
