Announcing the new Datavyu v1.3.6 with enhanced features and transcription support!

Hello, I would like to only export a single column from my spreadsheet to Excel. Also, I only need the codes to be exported and not onset/offset times. Is there a simple way I can do this besides exporting the entire spreadsheet? I've tried a couple different scripts, but now I stumped. Thanks!

asked 06 Feb, 10:38

kelseyvb's gravatar image

kelseyvb
11112
accept rate: 0%


Hi,

For your task, you will want to create a script with the following contents:


require 'Datavyu_API.rb'

output_file = '~/Desktop/output.csv' # location of output file
column_name = 'my_column' # name of column to export
codes = %w(code01 code02) # list of codes to export

data = []
getVariable(column_name).cells.each do |c|
  row = codes.map{ |x| c.get_arg(x) }
  data << row.join(',')
end

outfile = File.open(File.expand_path(output_file), 'w+')
outfile.puts(data)
outfile.close()

I've written this to work on 1.3.4 (to the best of my knowledge). If there are any error messages, you can put them here and I can help fix them.

If you want a different delimiter, feel free to change the filename extension and the argument inside the row.join() command.

permanent link

answered 06 Feb, 17:07

Shohan%20Hasan's gravatar image

Shohan Hasan ♦♦
381126
accept rate: 11%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×4

question asked: 06 Feb, 10:38

question was seen: 1,733 times

last updated: 06 Feb, 17:07

powered by OSQA