How to add dropdown button into Csv file during exportation

2.2k Views Asked by At

I need to Add dropdown button for each row in csv export file i am using Fastercsv gem for csv exportation and my code is

 csv_string = FasterCSV.generate({:col_sep => "\t"}) do |csv|
      csv << ["admission_no","first_name","last_name","dob"]
 end
 send_data(csv_string, :type => 'text/csv; charset=utf-8; header=present', :filename => "sample.csv")

I need to add or include the drop down button in the above array and that should have some options to select,i mean i want the dropdown button option in csv file itself the drop down should come in each row in csv file this is what i need to achieve so can any one help me out

1

There are 1 best solutions below

0
zwippie On

A CSV file is nothing more than a bunch of data entries separated by some character and line breaks. There is no way to create dropdowns in a CSV file.

If you want to add Excel functionality, create an .xslx file, not a .csv file. Perhaps with the help of a gem like axlsx. (Disclaimer: I haver never used that gem myself).