How to Merge Two Columns?

How do i merge two or more columns on the same row into one? Cutting & pasting from a table from a webpage has created extra columns that i liked to get rid of.

Unfortunately, there’s no easy way to merge columns, once they’ve been created. If you paste a table (which is likely tab-separated) into OmniOutliner, OmniOutliner assumes you’d like a table!

If you’d like to fix it, you can:

  • copy a row (or collection of rows)
  • paste them into your favorite text editor (TextEdit is free, and built-in)
  • find the tabs and replace them with space(s)
  • paste that back into OmniOutliner

And you’ll have “merged” rows again.

Sorry there’s not a faster way, but if you’d like to email omnioutliner@omnigroup.com, we’d be happy to add you to the open feature request!

1 Like

For OO versions with AppleScript support, here is a quick way. (Copy-paste script into Script Editor, select two columns to merge, and click run). The script places the merged values into a new, unnamed column. If the results are as desired, then delete the two original columns, and name the new column.

property separator : return -- if want space or comma, replace with " "  or "," 
tell application "OmniOutliner"
	tell document 1
		try
			set mrgCols to selected columns's index --> e.g. {4, 5}
			if (count mrgCols) is not 2 then error
			set newCol to make new column at after column (mrgCols's item 2)
			repeat with r in rows
				set val1 to r's cell (mrgCols's item 1)'s value
				set val2 to r's cell (mrgCols's item 2)'s value
				set r's cell ((mrgCols's item 2) + 1)'s value to val1 & separator & val2
			end repeat
		on error
			display dialog "Select two columns to merge" buttons "OK"
		end try
	end tell
end tell
2 Likes

@SGIII Thanks a ton for sharing this script! It’s great.

By chance, do you know how to “delete the two original columns” as you mention above? I suspect that I’m overlooking something simple, but I can’t figure out how to delete the columns that are no longer needed (at least when it’s the first column). Nor can I figure out to simply copy the new column generated by your script, and paste it into the first column (to then delete the others).

Thanks for any help you can lend! This has been driving me crazy. Your script has generated this fantastic new column for me, but now I can’t figure out how to get rid of the old stuff. Thanks! 🤦‍♂️️

I don’t think you can delete the first column. But to delete any other column I just select it by clicking the column title/name at the top so the whole column is highlighted, and then hit the key.

@SGIII Thanks for getting back to me.

Yeah, I’m afraid you’re correct. I did quite a bit of digging around yesterday, and I couldn’t find any way of deleting the first column (or even pasting new stuff over it). It’s baffling why OO would even embrace the use of columns without this functionality.