Posting an Excel Table

Is there a way to copy/paste an Excel table, retaining the column spacing, in a post? I tried the BB code tags “code” and “pre”, but neither maintained the correct spacing. Thanks in advance, I will likely promptly forget the how to, but at least by creating a thread I can always go back and search!

Let’s see

copy/paste:
time nuts bolts oranges
1985 1 8 2
1986 8 10 1
1987 8 5 7
1988 10 0 6
1989 4 8 6
1990 9 6 0
1991 2 6 9

Code tags:



time	nuts	bolts	oranges
1985	1	8	2
1986	8	10	1
1987	8	5	7
1988	10	0	6
1989	4	8	6
1990	9	6	0
1991	2	6	9


When a spreadsheet is copied in, tabs are assumed to separate columns. They appear to be maintained. The problem is that if a large number misaligns the fixed tabs. For example:



time	nuts	bolts	oranges
1985	1	8	2
1986	8	10	1
1987	8	5	7
1988	545554686	44	6
1989	4	8	6
1990	9	6	0
1991	2	6	9


To address such as situation, paste into a text editor. Then monkey around with fixed spacing. Tack on another tab as appropriate. Paste into box. Preview. Rinse and repeat:



time	nuts	   bolts	oranges
1985	1	   8		2
1986	8	   10		1
1987	8	   5		7
1988	5454686	   44		6
1989	4	   8		6
1990	9	   6		0
1991	2	   6		9


Code tags work properly on the desktop theme, but not on the mobile theme. PHP tags work correctly on both, but have odd color-coding that only makes sense for PHP code, and may occasionally have odd side-effects with non-PHP.

I note that I have already fixed that problem in my tweaking addon, and will gladly hand write the entire fix out (along with ones for a couple other things, like spoiler boxes in quotes and the highlighting issue) so that anyone with access to the skin or putting a style tag on the site can fix it.

I’ll redo my post, substituting php for code tags:

copy/paste:
time nuts bolts oranges
1985 1 8 2
1986 8 10 1
1987 8 5 7
1988 10 0 6
1989 4 8 6
1990 9 6 0
1991 2 6 9

Code tags:


time	nuts	bolts	oranges
1985	1	8	2
1986	8	10	         1
1987	8	5	7
1988	10	0	6
1989	4	8	6
1990	9	6	0
1991	2	6	9

When a spreadsheet is copied in, tabs are assumed to separate columns. They appear to be maintained. The problem is that if a large number misaligns the fixed tabs. For example:


time	nuts	bolts	oranges
1985	1	8	2
1986	8	10	1
1987	8	5	7
1988	545554686	44	6
1989	4	8	6
1990	9	6	0
1991	2	6	9

To address such as situation, paste into a text editor. Then monkey around with fixed spacing. Tack on another tab as appropriate. Paste into box. Preview. Rinse and repeat:


time	nuts	   bolts	oranges
1985	1	   8		2
1986	8	   10		1
1987	8	   5		7
1988	5454686	   44		6
1989	4	   8		6
1990	9	   6		0
1991	2	   6		9

Woops, looks like I need more editing in php:


time	nuts	 bolts	oranges
1985	1	      8		2
1986	8	     10	    1
1987	8	      5		7
1988	5454686   44		6
1989	4	      8		6
1990	9	      6		0
1991	2	      6		9

Thanks, all. Looks like, BigT’s fix notwithstanding, it’s going to always be a pain. I’ll try PHP:


Stays		Drive time	Days	Place
LA		0	5	
		6	1	Phoenix, AZ
		6	1	Las Cruces, NM
		6	1	Lubbock, TX
		6	1	Austin, TX
		6	1	Baton Rouge, LA
		8.5	1	Jacksonville, FL
Jacksonville		0	5	
		7.5	1	Rocky Mount, NC
		9	1	New York, NY
NY		0	5	
		6	1	Pittsburgh, PA
		6	1	Indianapolis, IN
		8	1	Eau Claire, WS
		7.5	1	Bismark, ND
		6	1	Billings, MN
		8	1	Spokane, WA
		4	1	Seattle, WA
Seattle		0	5	
		7	1	Medford, OR
		6	1	Modesto, CA
		6	1	LA, CA
		119.5	38	


Ugh, way too time consuming to tweak the spacing over and over.

Ugh is correct. But you get better after a while. I recommend working with a text editor as well the vBulletin window.

Don’t have a decent text editor? Get one (MS’s Notepad won’t display invisible characters). Don’t wanna? Then I’d recommend not posting tables; the process is indeed a PIA, though I do it from time to time.

In order to avoid the problems the new theme has with code tags, and also the general ugliness of code boxes, I go with [post=21230323]courier and hidden dots[/post].

That’s my new and improved format, which I’m quite happy with. The [post=21202105]previous version[/post] left a lot to be desired.

If you want to go with the hidden dots approach, I recommend keeping your lines 60 characters wide or less so phones have a reasonable chance to display them properly in landscape mde.