[Question]
  [
[We're getting markdown tables!](https://meta.stackexchange.com/questions/356997/feature-preview-table-support?cb=1) I assume this is what they look like:
```
     data
   data data  data
---------------------
 |                 |
 |                 |
 |                 |
 |                 |
```
Your task is to make a program or function to generate one of these tables. You'll be given input (string, list of lines, list of characters, etc.) containing data, which looks like this:
```
datadata
         data
  data           data
data data  data
```
The data consists of spaces and non-overlapping `data`s. The data will not necessarily form neat stacks (it can float in midair). There is guaranteed to be data on the top and bottom lines, as well as some touching the left side. You can choose if the data is right padded with spaces or not.
The table will always be six characters wider than the data, padded three spaces on the left. The table top is directly below the bottom row of data, and is made up of a line of `-`s.
As for the legs, everyone knows taller tables can support more weight, so they'll need to be one unit tall for every `data` in the input. They will be made up of `|`s, one space in from the sides.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer in bytes per language wins!
## Test cases
Input:
```
data
```
Output:
```
   data
----------
 |      |
```
Input:
```
data data data
 data data data
```
Output:
```
   data data data
    data data data
---------------------
 |                 |
 |                 |
 |                 |
 |                 |
 |                 |
 |                 |
```
Input:
```
data
data
```
Output:
```
   data
   
   data
----------
 |      |
 |      |
```
  
[Answer]
# [Perl 5](https://www.perl.org/) `-lpF`, ~~88~~ ~~74~~ 66 bytes
*Because we're allowed to require the input to be padded on the right side, @DomHastings was able to shave 8 bytes off my method while eliminating the need for `List::Util`.*
```
END{printf'-'x(@F+6)."
 |%@{[@F+3]}s"x$q,("|")x$q}s//   /;$q+=y;d;
```
[Try it online!](https://tio.run/##K0gtyjH9/9/Vz6W6oCgzryRNXVe9QsPBTdtMU0@JS6FG1aE6Gsgzjq0tVqpQKdTRUKpR0gQyaov19RUUFPStVQq1bSutU6z//09JLEkEYQVkwKWADSBEkTVwoXKhslxgMYgEQvpffkFJZn5e8X9dX5/M4hIrq9CSzBzb3MQKoICpnoGhwX/dghw3AA "Perl 5 – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~31~~ ~~30~~ 28 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
¬g6+©'-×ªð®×'|1®Í‚ǝIJ'd¢и«.c
```
-1 byte thanks to *@ovs*.
Input as a list of lines, right-padded with spaces to an equal length.
[Try it online](https://tio.run/##yy9OTMpM/f//0Jp0M@1DK9V1D08/tOrwhkPrDk9XrzEEUr2PGmYdn@vppZ5yaNGFHYdW6yX//x@tlJJYkgjCCshASUdBSQEbQJFA1gaRQDMIxAVJgIUhcggVSrEA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@m5JlXUFpipaBkX6nDpeRfWgLh6VT@P7Qm3Uz70Ep13cPTD606vOHQusPT1WsMgVTvo4ZZx@dWeqmnHFp0Yceh1XrJ/3UObbP/Hx2tpKCQkliSqAADSjpKYD5EEEQqxeooRIMFURRCFCsoKWADKBLI2iASaAaBbQFKoFkM1RGrA7EdzlBAEEDXKqAKIZTrKCH5Ryk2FgA).
**Explanation:**
```
¬                  # Get the first line of the (implicit) input-list (without popping)
 g                 # Pop and push its length
  6+               # Add 6
    ©              # Store this value in variable `®` (without popping)
     '-×          '# Pop and create a string of that many "-"
        ª          # Append it to the list of lines
ð®×                # Create a string consisting of `®` amount of spaces
     1             # Push 1
      ®Í           # Push value `®` and decrease it by 2
        ‚          # Pair them together: [1,®-2]
   '|    ǝ        '# Insert a "|" at those (0-based) indices in the spaces-string
          IJ       # Push the input-list, and join it to a single string
            'd¢   '# Count the amount of "d"s in it
               и   # Repeat the legs-string that many times as list
                «  # And merge the two lists together
.c                 # And finally centralize this list, which adds leading spaces where
                   # necessary, and implicitly joins the list by newlines
                   # (after which the result is output implicitly)
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~60 57 56 55~~ 41 bytes
```
{3⌽↑(↓'-'⍪⍨' '∘,⍣6⊢⍵),↓(+/∊'d'⍷⍵)6⍴' | '}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///v9r4Uc/eR20TNR61TVbXVX/Uu@pR7wp1BfVHHTN0HvUuNnvUtehR71ZNHaC0hrb@o44u9RSgou0gMbNHvVvUFWoU1Gv/pz1qm/Cot@9RV/Oj3jVA4UPrjYFmPuqbGhzkDCRDPDyD/6cpGCqYgLSkJJYkqnMBhYGa1NW50hSASsGCCnAC6AAFNBFsGoDKgAjMAgA "APL (Dyalog Unicode) – Try It Online")
Input as a character matrix.
-1 byte from ovs.
-14 bytes, following xash's answer.
## Explanation(old)
```
{↑('   '∘,¨↓⍵),(⊂a/'-'),(+/∊'d'⍷⍵)/⊂2⌽'|  |'↑⍨a←6+⊃⌽⍴⍵}
                                      '|  |'                 a set of table legs
                                            ↑⍨               pad to length
                                              a←6+⊃⌽⍴⍵       6 + row size
                                       a←                    store in var a
                                    ⊂2⌽                      rotate 2 steps and wrap
                         (        )/                         replicate that by:
                             'd'⍷⍵                           boolean matrix of occurrences of 'data'   
                          +/∊                                sum all the occurrences
                        ,                                    concatenate with
               (⊂a/'-')                                      '-' repeated a times
  ('   '∘,¨↓⍵),                                              and the input padded with 3 spaces on the left
 ↑                                                           convert to matrix(join with newlines)
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~30~~ ~~28~~ 27 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Hmm ... thought this would work out much shorter.
Takes input as an array of lines, right-padded with spaces and outputs an array of lines.
```
cU¬èd ô@S+i|i|úUÎÊ+3ÃvÈç-
û
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=Y1Ws6GQg9EBTK2l8aXz6Vc7KKzPDdsjnLQr7&footer=VnFS&input=WyJkYXRhICAgICAgICAgICAiLCJkYXRhIGRhdGEgIGRhdGEiXQ) or [run all test cases](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=Y1Ws6GQg9EBTK2l8aXz6Vc7KKzPDdsjnLQr7&footer=UrJpVrc&input=WwpbImRhdGEgICAgICAgICAgICIsImRhdGEgZGF0YSAgZGF0YSJdClsiZGF0YWRhdGEgICAgICAgICAgICAgIiwiICAgICAgICAgICAgICAgICAgICAgIiwiICAgICAgICAgZGF0YSAgICAgICAgIiwiICBkYXRhICAgICAgICAgICBkYXRhIiwiZGF0YSBkYXRhICBkYXRhICAgICAgIl0KWyJkYXRhIl0KWyJkYXRhIGRhdGEgZGF0YSAiLCIgZGF0YSBkYXRhIGRhdGEiXQpbImRhdGEiLCIgICAgIiwiZGF0YSJdCl0tbVI)
```
cU¬èd ô@S+i|i|úUÎÊ+3ÃvÈç-\nû     :Implicit input of array U
c                                :Concatenate
 U¬                              :  Join U
   èd                            :  Count the "d"s
      ô                          :  Range [0,count]
       @                         :  Map
        S                        :    Space
         +                       :    Append
          i                      :      A space prepended with
           |i                    :        A "|" prepended with
             |ú                  :          A "|" right padded with spaces to length
               UÎÊ+3             :          Length of first element of U plus 3
                    Ã            :End map
                     v           :Modify first element
                      È          :By passing it through the following function
                       ç-        :  Fill with "-"
                         \n      :Reassign to U (saves a byte over having to close all the nested methods)
                           û     :Centre pad each element with spaces to the length of the longest
```
[Answer]
# [J](http://jsoftware.com/), 41 bytes
```
0 3|.(' | '$~6,~1#.'d'=,),~'-',~' '&,.^:6
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/DRSMa/Q01BVqFNRV6sx06gyV9dRT1G11NHXq1HXVgYSCupqOXpyV2X9NLq7U5Ix8BQ3rNE2FaGu9eCMFDbBZmlwKCimJJYlcIALMgvLx6IDJ41ehACe4FND4mgS0ckGt@A8A "J – Try It Online")
### How it works
* `' '&,.^:6` prepend a space to each row 6 times.
* `'-',~` append a new row filled with `-`.
* `1#.'d'=,` count the `d`s in the input.
* `' | '$~6,~` shape  `|`  into dimensions `count 6`, so `count` rows of  `| |`
* `,~` append the leg rows to the tables, filling possible empty space on the right with .
* `0 3|.` shift every row 3 characters to the left.
Or in pictures:
```
data
      data
      data
----------
      data
----------
 |  |
    data   
-----------
 |       |
```
[Answer]
# [Ruby 2.7](https://www.ruby-lang.org/), ~~112~~ ~~98~~ ~~77~~ 74 bytes
*Saved 6 bytes using* `String#count` *method, thanks to [Razetime](https://codegolf.stackexchange.com/users/80214/razetime)!*  
*Saved 3 bytes using literal newline, thanks to [Dingus](https://codegolf.stackexchange.com/users/92901/dingus)!*
```
->m{m.map{" "*3+_1}<<?-*(6+c=m[0].size)+"
 | #{" "*c} |"*(m*"").count(?d)}
```
[Try it online!](https://tio.run/##dY69DoIwFIX3PsXNcYHyExMTJ5AHAQYESRyKhJZBKc9eA0isBE9yp@/83K6/Pk0dm@AiBhGKoh201CDwkyfHKEoC7py9MhbpMQ/l/XVzPTDSdBgmTzmSBncEB9ywfPSNcpLKHU3bK0l1mqIqVIE89wlZkzVgbCVsRtORLfgMtKcfYMcWsCmaZ/1l48O@DrD9hzYtO/l/yXXOjtle8wY "Ruby – Try It Online")
* TIO uses an older version of Ruby, while in Ruby 2.7, we've numbered parameters, i.e., `_1`, which saves 2 bytes.
[Answer]
# [Python 3.8](https://docs.python.org/3.8/), ~~113~~ ~~107~~ 95 bytes
Saved ~~6~~ a whopping 18 bytes thanks to [Dom Hastings](https://codegolf.stackexchange.com/users/9365/dom-hastings)!!!
```
lambda l:['   '+a for a in l]+[(r:=6+len(l[0]))*'-']+''.join(l).count('d')*[' |'+(r-4)*' '+'|']
```
[Try it online!](https://tio.run/##3VTBToQwEL3zFZNepl3KRqNRQ8LRHzDekENduorBQko3UcO/IwWEssDRmDgJBN6bN9OZtlN@mtdCXd2VujlGT00u3p9TAXkYIwCgL@BYaBCQKcgTP6Y6jG78XCqaxxcJYzsMMPER929F1mJsfyhOylBMke3aCDX6VAfXrVsbCmtMGiMrU0XUi0kqjLAPuEY4EFizGeHKeuIskP21RAf33ORBeMKH/GT8gulFOIE5NLlZrgsxypknP0p5MDK1VeGQfFEYckDYsHPOFY/cSoUDt1qk5YJt66T1xnrqf8h2O@icjKkVdksHXU1cN2f/@11fgKutdeK5K/gLeF40GW@Mg2304awnzLNTwHBp58BXVtLuGnP4Ofos9KxvqbP28pPHljyISoaEdfA4QUzYe4ge19GRGuYqH6Q5aSXThVLPlRbPOlyoF0ntPDJ2Hvk3bHCsjKYZi4PLhEuVRohunlnO@6GGRU75azkxwp0T4Jax5hs "Python 3.8 (pre-release) – Try It Online")
Inputs a list of right-space-padded strings and returns a list of strings.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 36 bytes
```
Ỵ⁶x3¤;ṄƊ€ẈṀ+©3”-xṄṛċ”d®e®’,2¤¥þị⁾| Y
```
[Try it online!](https://tio.run/##y0rNyan8///h7i2PGrdVGB9aYv1wZ8uxrkdNax7u6ni4s0H70ErjRw1zdSuAwg93zj7SDeSkHFqXemjdo4aZOkaHlhxaenjfw93djxr31ShE/v//PyWxJBGEFZABlwI2gBBF1sCFyoXKcoHFIBIIaQA "Jelly – Try It Online")
Takes input as a single string.
This is disgustingly hacked together, but Jelly's never been particularly good at strings.
## How it works
```
Ỵ⁶x3¤;ṄƊ€ẈṀ+©3”-xṄṛċ”d®e®’,2¤¥þị⁾| Y - Main link. Takes s on the left
Ỵ                                    - Split into a list of lines
       Ɗ€                            - Over each line l:
    ¤                                -   Group together as a nilad:
 ⁶                                   -     " "
  x3                                 -     [" ", " ", " "]
     ;                               -   Prepend to l
      Ṅ                              -   Print
         Ẉ                           - Get the lengths of each line
          Ṁ                          - Take the maximum
           + 3                       - Add 3
            ©                        - Save it to the register, r
              ”-                     - "-"
                x                    - Repeat that many times
                 Ṅ                   - Print
                  ṛ                  - Discard everything and use s
                   ċ”d               - Count occurrences of "d", d
                      ®              - Yield the register, r
                             ¥þ      - Create an d×r grid and to each cell (i, j):
                            ¤        -   Group into a nilad:
                        ®            -     r
                         ’           -     r-1
                           2         -     2
                          ,          -     [r-1, 2]
                       e             -   Is i in [r-1, 2]?
                               ị⁾|   - Index each cell into "| "
                                   Y - Join by newlines
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~29~~ 25 bytes
```
ＷＳ⊞υι↑№ΣυdＭ←³Ｌθ←Ｆυ↑‖ＯＯＬθυ
```
[Try it online!](https://tio.run/##bYxNDoIwEIX3PcWEVZvgyh0sXZlgJBIO0EChJJXWOq3Hr1UIP9FJJjPzvTevkdw2mqsQXnJQAuh5NA4rtMPYU8agdE9JXQoDy0kZIdKsNimctItr5e7UsRSSNmFRv2gvaFaIDhfzcdkKMfYo6ePH2GkLMQUmWJuIbqJTosGrF1ZxM49dwpTpWB5Cy5F/GrZF4F@tdPtA9ueski@bhFUm4eDVGw "Charcoal – Try It Online") Link is to verbose version of code. Takes newline-terminated rectangular input. Explanation:
```
ＷＳ⊞υι
```
Input the data.
```
↑№ΣυdＭ←³
```
Print the left leg and the `---` at the top of the left leg.
```
Ｌθ
```
Print the middle part of the table.
```
←Ｆυ↑
```
Move the cursor to the top right of the data. The following reflection will then move it to the top left. (Moving here avoids confusion between the use of the arrows as movement and as modifiers for reflection or printing direction.)
```
‖ＯＯＬθ
```
Reflect to complete the right of the table.
```
υ
```
Print the data.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~204~~ ~~194~~ ~~187~~ ~~181~~ 174 bytes
*174-byte solution thanks to @ceilingcat.*
```
z,s,i;main(c,v)char**v;{for(;++z<c;)printf("   %s\n",v[z]);for(;c--;)for(s=0;z=v[c][s++];)i+=z=='d';for(;z++<strlen(v[1])+6;putchar(45));for(;i--;)printf("\n |%*c",z-4,'|');}
```
[Try it online!](https://tio.run/##VY3LCsIwFER/JRRKk94EFKqb23xJ20W4tRrQWJqaRazfHqkPxM0wDIczpI5EKUXppcWLsY6TDIJOZirLgPfhOnEEiDWhGCfr5oFnjLHcty6ToYmdwBdCSqFYm9cbjDo01DUeoENhQUeti754gxGg9vN0Pjgemm0nYI/jbV7/eLUTH5tdbd@71rElLymTUVWyWAqBj5RSb2bDfpHY//AE "C (gcc) – Try It Online")
Takes each line of input as a right-padded command line argument.
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 53 bytes
```
\`.+
   $&   
L$`d
$%=
T`p`-
*\0G`
T`-` 
%,T1,,-2` `|
```
[Try it online!](https://tio.run/##K0otycxLNPz/PyZBT5tLQUFBRQ1IcPmoJKRwqajacoUkFCTocmnFGLgnANm6CQpcqjohhjo6ukYJCgk1//@nJJYkgrACMuBSwAYQosgauFC5UFkusBhEAiENAA "Retina – Try It Online") Takes rectangular input. Explanation:
```
\`.+
   $&   
```
Pad the input by 3 spaces on each side and print the result.
```
L$`d
$%=
```
Repeat each line by the count of its `d`s.
```
T`p`-
```
Change all the characters to `-`s.
```
*\0G`
```
Print the first line.
```
T`-` 
```
Change all the characters to spaces.
```
%,T1,,-2` `|
```
Change the (0-indexed) second and second last characters to `|`s and implicitly print the resulting legs.
[Answer]
# JavaScript (ES6), ~~105~~ 103 bytes
Expects a single string with right-padded lines.
```
s=>s[R='replace'](/^|t/g,c=>o+=`
`+(p=c?' | ':'---')+q[R](/./g,p[0])+p,o=s[R](/.+/g,s=>'   '+(q=s)))&&o
```
[Try it online!](https://tio.run/##jYxBCoMwEEX3OcXgwkmI0a4LsXdwqxZD1NIiSTTSlXdPU1oqhS46i4F58/6/qbvyerm6VRjbD2GUwcvS15XEZXCT0gO2tDhva3HJtCwtlx3pOHVSnxA2wCMKIZDxua6il0fL1YeWcZdZ6V@MRxg7EQCQ01l6xlia2qCt8XYa8sle6EgJQNKrVSWEAQdsDDJCfiuwr8YkwJ8cvh9/tOzROJ/jHWbhAQ "JavaScript (Node.js) – Try It Online")
### Commented
```
s =>                     // s = input string
s[R = 'replace'](        // replace in s:
  /^|t/g,                //   match the beginning of the string
                         //   and each 't' (of 'data')
  c =>                   //   for each matching character c:
    o +=                 //     append to o:
      `\n` + (           //       a line-feed
        p =              //       followed by p defined as:
          c ?            //         if c is not empty:
            ' | '        //           ' | '
          :              //         else:
            '---'        //           '---'
      )                  //
      + q[R](/./g,       //       followed by each character in q ...
                   p[0]) //       ... replaced with the 1st character of p
      + p,               //       followed by p
  o =                    //   initialize the output string o:
    s[R](                //     replace in s:
      /.+/g, s =>        //       each line s
        '   '            //       with 3 leading spaces
        + (q = s)        //       followed by s, which is copied in q
    )                    //     end of replace()
) && o                   // end of replace(); return o
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 38 bytes
```
Ỵ⁶x3¤;Ɱ©ẈṀ+3µ⁶ẋ”|2,-¦Wẋ³ċ”d¤;@”-xWƊ®;Y
```
[Try it online!](https://tio.run/##y0rNyan8///h7i2PGrdVGB9aYv1o47pDKx/u6ni4s0Hb@NBWoPDDXd2PGubWGOnoHloWDuQc2nwEJJACVOwApHUrwo91HVpnHfn///@UxJJEEObiUoABMBdCKSigioLFIBIgEgA "Jelly – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/) + `-pl055F`, 53 bytes
A different approach to [@Xcali's answer](https://codegolf.stackexchange.com/a/215961/9365). Requires lines to be padded with spaces.
```
$;+=y/d//;say"   $_"}{$\=$\x(6+($#x=@F))."
 | @x |"x$
```
[Try it online!](https://tio.run/##K0gtyjH9/1/FWtu2Uj9FX9@6OLFSSUFBQSVeqbZaJcZWJaZCw0xbQ0W5wtbBTVNTT4lLoUbBoUKhRqlC5f//lMSSRBBWQAZcCtgAQhRZAxcqFyrLBRaDSCCk/@UXlGTm5xX/1y3IMTA1dfuv62uqZ2igZwAA "Perl 5 – Try It Online")
## Explanation
Firstly, `-l055` sets `$\` to `'-'`, `-p` implicitly wraps wraps the code in `while(<STDIN>){...;print;}` and `-F` splits each line of input into chars in `@F`.
In the code, due to the implicit code added by `-p`, for each line of text increment `$;` with the number of `d` in the code then `say` the line with three leading spaces. The `}{` breaks out of the implicit `while` and `$\` is then set to `$\` repeated 6+`@F` (whilst also setting `$#x` to `@F`'s scalar value) times concatenated with a string consisting of: a leading newline, space, pipe (`|`), space, `@x` interpolated, space, pipe, which itself it repeated `$;` times.
`@F`, when used in a scalar context like this, returns the number of elements in `@F` - which is the number of chars in the line, since each line is space-padded this works fine. `$#x` is a 'magic' variable which contains the last index of `@x` and means that `@x` now contains `@F`+1 empty values. When an array is interpolated into a double-quoted string, its values are printed out with a space between each, so an empty array with `@F`+1 elements interpolated, results in a string consisting of `@F` spaces. This code ends with just `$` because of the `-p`-added code which contains `;` saving another byte.
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 36 bytes
```
P'-M@P*gWRsX3LXW*4N JgPsX#a+2WR'|WRs
```
Takes lines of input as command-line arguments; or, with the -r flag, as lines of stdin. Lines must be padded with spaces to the same length. [Try it online!](https://tio.run/##K8gs@P8/QF3X1yFAKz08qDjC2CciXMvET8ErPaA4QjlR2yg8SL0GKPH/f0piSSIIKyADLgVsACGKrIELlQuV5QKLQSQQ0v91iwA "Pip – Try It Online")
### Explanation
Let's break this into two halves: the data + tabletop, and the legs.
```
P'-M@P*gWRsX3
       g       List of input lines
        WR     Wrap each line in
          sX3  Three spaces
     P*        Print each line
    @          Take the first one
 '-M           List containing one hyphen for each character in that line
P              Print (concatenated together by default)
LXW*4N JgPsX#a+2WR'|WRs
       Jg                Join the lines of input into one string
     N                   Count occurrences in that string of
 XW                      Regex matching [a-zA-Z0-9]
   *4                    repeated 4 times
L                        Loop that many times:
             a            First line of input
            #             Length
              +2          Plus 2
          sX              String of that many spaces
                WR'|      Wrap in pipe characters
                    WRs   Wrap in spaces
         P                Print
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `ao`, 34 bytes
```
ƛ3Ip…L;G:3+\-*,‹‛ƛ↓□⁋ẎL$I‛ |p‛|
+*
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJhbyIsIiIsIsabM0lw4oCmTDtHOjMrXFwtKizigLnigJvGm+KGk+KWoeKBi+G6jkwkSeKAmyB8cOKAm3xcbisqIiwiIiwiZGF0YVxuICAgZGF0YSJd) Probably not optimal, but beats Jelly :P
`a` flag is for multiline input; `o` forces implicit output even though there are print statements in the code.
```
ƛ3Ip…L;G:3+\-*,‹‛ƛ↓□⁋ẎL$I‛ |p‛|
+*                                # Full program
ƛ     ;                     # For each line in input (`a` flag):
 3Ip                        #   Prepend 3 spaces
    …                       #   Print ^
     L                      #   and return its length
G:                          # Take the maximum length from ^ and duplicate
  3+                        # Add 3 to one copy
    \-*,                    # Print that many `-`s
        ‹                   # Decrement the other maximum length copy for later
            □⁋              # From inputs...
              ẎL            # ...find the number of
         ‛ƛ↓                # ...`data`s (dictionary-compressed)
                $           # Swap number of "data"s for (maximum length - 1)
                 I          # Push that many spaces
                  ‛ |p      # Prepend " |" to ^
                      ‛|\n+ # Append "|\n" to ^ (\n is an actual newline)
 *                          # Repeat as many times as the number of datas to make the legs
                            # `o` flag - implicitly output the legs of the table
```
]