Page 1 of 1
quick way to strip lines from excel
Posted: Wed Jan 20, 2016 5:57 pm
by tester
Is there a quick way to strip multiple lines via ruby from excel copypaste content?
The problem is with empty cells on the beginning and end of the line. Cells are tab separated.
Re: quick way to strip lines from excel
Posted: Wed Jan 20, 2016 6:15 pm
by tulamide
Depends on what you want to do with the data. Should it stay text, including tabs? Or should it be a string array, where a tab without data before results in an empty string entry, like this:
tab5tabtab5return = ["", "5", "", 5]
Re: quick way to strip lines from excel
Posted: Wed Jan 20, 2016 6:36 pm
by tester
Can be both, tab version goes for output.
Re: quick way to strip lines from excel
Posted: Wed Jan 20, 2016 6:54 pm
by tulamide
Hope this helps?
Re: quick way to strip lines from excel
Posted: Wed Jan 20, 2016 9:38 pm
by tester
I'm not exactly sure how to send to output(s) selected input lines?
(I think I messed a bit the question too).
What I'm trying to get is something like on structure in schematic.
Theme 1: cleaning excel copy/paste content from unused lines ( = selecting desired lines), but keeping formatting (tabs),
Theme 2: from that output - selecting some individual lines as arrays (which will contain empty/nil lines, sometimes on the beginning or end).
Basically I'm trying design a sort of statistical calculation sheet for measuremental data.
Re: quick way to strip lines from excel
Posted: Thu Jan 21, 2016 2:30 am
by tulamide
Like this?
Re: quick way to strip lines from excel
Posted: Fri Jan 22, 2016 12:44 pm
by tester
Appearently there is some problem within it, because it works with simple matrix and produces an error with larger one. But I found a workaround, and it works.
For conversion between tabs and some reference mark I use something like this:
and then this little fellow works fine with indexes:
Code: Select all
output 0, @my_array.values_at(*@indexes)