quick way to strip lines from excel

For general discussion related FlowStone
Post Reply
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

quick way to strip lines from excel

Post 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.
Attachments
lines and nils.fsm
(331 Bytes) Downloaded 847 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: quick way to strip lines from excel

Post 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]
"There lies the dog buried" (German saying translated literally)
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: quick way to strip lines from excel

Post by tester »

Can be both, tab version goes for output.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: quick way to strip lines from excel

Post by tulamide »

Hope this helps?
Attachments
lines and nils[tula].fsm
(625 Bytes) Downloaded 825 times
"There lies the dog buried" (German saying translated literally)
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: quick way to strip lines from excel

Post 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.
Attachments
Schematic1.fsm
(501 Bytes) Downloaded 846 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: quick way to strip lines from excel

Post by tulamide »

Like this?
Attachments
Schematic1[tula].fsm
(965 Bytes) Downloaded 828 times
"There lies the dog buried" (German saying translated literally)
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: quick way to strip lines from excel

Post 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:

Code: Select all

output @in.tr("\t","^")


and then this little fellow works fine with indexes:

Code: Select all

output 0, @my_array.values_at(*@indexes)
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Post Reply