# How to Write to csv file to create bulk address book

**URL:** <https://www.ruby-forum.com/t/how-to-write-to-csv-file-to-create-bulk-address-book/155077>\
**Category:** Ruby\
**Created:** [December 7, 2008, 3:00pm UTC](https://www.ruby-forum.com/t/how-to-write-to-csv-file-to-create-bulk-address-book/155077 "2008-12-07T15:00:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iPerfect](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ad7895/32.png) [@iPerfect](https://www.ruby-forum.com/u/iPerfect)\
**Post date:** [December 7, 2008, 3:00pm UTC](https://www.ruby-forum.com/t/how-to-write-to-csv-file-to-create-bulk-address-book/155077/1 "2008-12-07T15:00:51Z")

</div>

Hi ,

I am new to ruby, I am working on script which would create ‘n’  
number address book entries into a csv file which would be used to  
import into a address book. I need suggestions for the same

The fileds for csv file are as follows

““Title”,“First Name”,“Middle Name”,“Last  
Name”,“Suffix”,“Company”,“Department”,“Job Title”,“Business  
Street”,“Business Street 2”,“Business Street 3”,“Business  
City”,“Business State”,“Business Postal Code”,“Business Country”,“Home  
Street”,“Home Street 2”,“Home Street 3”,“Home City”,“Home State”,“Home  
Postal Code”,“Home Country”,“Other Street”,“Other Street 2”,“Other  
Street 3”,“Other City”,“Other State”,“Other Postal Code”,“Other  
Country”,“Assistant’s Phone”,“Business Fax”,“Business Phone”,“Business  
Phone 2”,“Callback”,“Car Phone”,“Company Main Phone”,“Home Fax”,“Home  
Phone”,“Home Phone 2”,“ISDN”,“Mobile Phone”,“Other Fax”,“Other  
Phone”,“Pager”,“Primary Phone”,“Radio Phone”,“TTY/TDD  
Phone”,“Telex”,“Account”,“Anniversary”,“Assistant’s Name”,“Billing  
Information”,“Birthday”,“Business Address PO  
Box”,“Categories”,“Children”,“Directory Server”,“E-mail Address”,“E-  
mail Type”,“E-mail Display Name”,“E-mail 2 Address”,“E-mail 2 Type”,“E-  
mail 2 Display Name”,“E-mail 3 Address”,“E-mail 3 Type”,“E-mail 3  
Display Name”,“Gender”,“Government ID Number”,“Hobby”,“Home Address PO  
Box”,“Initials”,“Internet Free  
Busy”,“Keywords”,“Language”,“Location”,“Manager’s  
Name”,“Mileage”,“Notes”,“Office Location”,“Organizational ID  
Number”,“Other Address PO  
Box”,“Priority”,“Private”,“Profession”,“Referred  
By”,“Sensitivity”,“Spouse”,“User 1”,“User 2”,“User 3”,“User 4”,“Web  
Page””

All the entries written by csv file by script can be random & dummy as  
this address book is used for testing purpose.

Thank you in advance,  
Kanthi

---

<div class="post-metadata">

**Author:** ![iPerfect](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ad7895/32.png) [@iPerfect](https://www.ruby-forum.com/u/iPerfect)\
**Post date:** [December 7, 2008, 6:43pm UTC](https://www.ruby-forum.com/t/how-to-write-to-csv-file-to-create-bulk-address-book/155077/2 "2008-12-07T18:43:06Z")

</div>

On Dec 7, 2008, at 7:53 AM, iPerfect wrote:

> I am new to ruby, I am working on script which would create ‘n’  
> number address book entries into a csv file which would be used to  
> import into a address book.

> All the entries written by csv file by script can be random & dummy as  
> this address book is used for testing purpose.

Does the Faker library meet your needs?

[http://faker.rubyforge.org/](http://faker.rubyforge.org/)

James Edward G. II

---

<div class="post-metadata">

**Author:** ![iPerfect](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ad7895/32.png) [@iPerfect](https://www.ruby-forum.com/u/iPerfect)\
**Post date:** [December 7, 2008, 10:14pm UTC](https://www.ruby-forum.com/t/how-to-write-to-csv-file-to-create-bulk-address-book/155077/3 "2008-12-07T22:14:55Z")

</div>

The fastercsv gem lets you open and write CSV files. So you just need to  
generate some suitable random-ish values to pass to it.
