# Delete Enitre column in excel using ruby code

**URL:** <https://www.ruby-forum.com/t/delete-enitre-column-in-excel-using-ruby-code/165905>\
**Category:** Ruby\
**Created:** [April 19, 2009, 3:30pm UTC](https://www.ruby-forum.com/t/delete-enitre-column-in-excel-using-ruby-code/165905 "2009-04-19T15:30:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c67d28/32.png) [@rubist](https://www.ruby-forum.com/u/rubist)\
**Post date:** [April 19, 2009, 3:30pm UTC](https://www.ruby-forum.com/t/delete-enitre-column-in-excel-using-ruby-code/165905/1 "2009-04-19T15:30:53Z")

</div>

Hi All,  
I need to delete entire column(GB) in excel using ruby code.  
let me whether i should write some code or is there a way to call an  
macro in excel.  
whichever is simpler or easy way to maintain.

---

<div class="post-metadata">

**Author:** ![rubist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c67d28/32.png) [@rubist](https://www.ruby-forum.com/u/rubist)\
**Post date:** [April 19, 2009, 5:46pm UTC](https://www.ruby-forum.com/t/delete-enitre-column-in-excel-using-ruby-code/165905/2 "2009-04-19T17:46:06Z")

</div>

Idealone I. wrote:

> Hi All,  
> I need to delete entire column(GB) in excel using ruby code.  
> let me whether i should write some code or is there a way to call an  
> macro in excel.  
> whichever is simpler or easy way to maintain.

Where ws is your Worksheet object:

ws.Columns(‘GB’).Delete

More info on automating Excel with Ruby can be found here:

[Ruby on Windows: excel](http://rubyonwindows.blogspot.com/search/label/excel)

David

> **[Ruby on Windows](http://rubyonwindows.blogspot.com)**
>
> On using the Ruby programming language on the Microsoft Windows platform
