Forget Web Console etc.
Use the Ruby Console from the Sketchup Menu > Window...
Any file with a .rb file-extension that's in the Plugins folder will auto-load as Sketchup starts.
Or if it's added later or it's in a subfolder you can type a load command in the Console.load "test.rb"
if you've made a subfolder.
If you change and save you code you can simply reload it with the same 'load' command again without needing to restart Sketchup.
To make the script use PC's Notepad.exe or equivalent plain-text editor - never a wordprocessor.
Save it as say "test.rb" - note the file-extension.
Copy paste the code I gave into the file and save.
Adjust the code as needed to get the right results needed for the OCS.
To save the file as something other than ".CSV" just change the suffix added to the 'file' in the code - e.g. ".TXT"***
To run this test method it's not wrapped in a module or class for simplicity...
To use it ensure it's loaded, then select an instance in the [saved] SKP and in the Ruby Console typecsv_test
to run it...
The transformations are saved into a file with the SKP...
***You might want to think about changing the method's title to something without 'csv' in it if there are no Commas