9

I noticed a pattern with Excel and Google Sheets questions that sample data is often presented in non-optimal ways. The data may not exist, only a screenshot of the image requiring someone to build their sample data, or perhaps an ANSI/ASCII type table with data is given. I saw that StackOverflow has a code snippet feature in the toolbar. I wonder if something similar is planned for SuperUser to host CSV or tab delimited data for database, spreadsheets, or any grid-like applications such as Excel?

6
  • No, and anyways, we don't need your entire datasheet to reproduce whatever you want to do. A mere representation is enough. Like this
    – Braiam
    Jun 15, 2016 at 1:12
  • Yeah perfect example of sample data that you have to re type. And some sample data unfortunately is more than three rows to explain properly
    – Sun
    Jun 15, 2016 at 1:15
  • Actually, I typed nothing. I just looked for one of these nice online ascii table generators because while I explained it with just words a graphical representation.
    – Braiam
    Jun 15, 2016 at 1:47
  • 1
    I'm not talking about the person asking the question. I'm referring to proper that answer questions have to recreate the data to provide the answer with proof. The way you posted your question means I have to recreate your data then going about solving it. The format you present IDs good for visual presentation but not for importing into excel. Certainly better than a screenshot but still not easy to import into excel
    – Sun
    Jun 15, 2016 at 2:27
  • Why should we care about importing to excel or whatever? Datasets are as generic as they can be and the most help you can get is "this is the formula that you can use to do that" or "here's a vba macro that does what you like". Proof/examples is just something extra, a visualization of what it should looks like. Spreadsheets aren't visual tools, but heavily text based. Instructions can be given using text just fine too.
    – Braiam
    Jun 15, 2016 at 2:31
  • Proof shows you verified your work and there is trust in your answer. I've tried people's solution where it didn't work. No proof invites wrong answers. Hey no one is stopping you from asking how you wish. I personally won't bother solving questions if loading data to prove a solution takes too much time. For example, your question I wouldn't bother with because the data is not import friendly. Who knows maybe there are others that can provide a brilliant answer but by not making it easy to answer, people are discouraged to answer. I just see a blocker here and wish there was a better way.
    – Sun
    Jun 15, 2016 at 2:37

1 Answer 1

4

I’ve been advising people to post their spreadsheet data as columnar text in “Code Sample” format, as was done here, here, and other places.  This is not very hard to generate.  For example, if you have these data:

       image of Excel sheet (same data as below)

and you copy and paste as text, you get TSV data:

CompanyTabPersonTabNumber
ACMETabL. FoggTab17
Sirius Cybernetics CorporationTabZaphod BeeblebroxTab42

If you have Unix/Linux (or even Cygwin), you can get from that to the desired columnar form with the command column -t -s$'\t' -o' '; as in:

$ cat data
Company Person  Number
ACME    L. Fogg 17
Sirius Cybernetics Corporation  Zaphod Beeblebrox       42

$ column -t -s$'\t' -o'    ' data
Company                           Person               Number
ACME                              L. Fogg              17
Sirius Cybernetics Corporation    Zaphod Beeblebrox    42

… or you can do it with a web service, like this (although I have trouble getting those to work well).  Or you can do it by pasting the TSV data into your browser and changing the tabs to spaces manually.  Then, of course there are several ways to get the data into “Code Sample” format:

  • Select the data and

    • click on the {} button, or
    • type Ctrl+K

    or

  • manually insert four spaces at the beginning of every line (this is what the previous option does automatically), or
  • insert <pre> (and optionally <code>) before the data, and </pre> (and optionally </code>) after.

And of course you can reverse the process by copying the above into Excel and using “Text to Columns”.


You say, “I’d like to see markdown syntax for tables implemented by SE sites.”  This sounds like something that has been requested before (more than once):

and the response (apparently from authoritative sources) has been a firm “No”:

We do not (and will not) allow <table> tags.  Sorry.  This is intentional and by design.  If you need a quick and dirty “table”, use <pre> and ASCII layout.

Somewhat ironically, they seem to have enabled it on Stack Overflow: if you enter

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

<table><tr><th>Company<th>Person<th>Number
<tr><td>ACME<td>L. Fogg<td>17
<tr><td>Sirius Cybernetics Corporation<td>Zaphod Beeblebrox<td>42

<!-- end snippet -->

it renders initially as

before

and, if you click on ▶ Run code snippet, you get

after

which can be copied and pasted into Excel.  But I’m not sure what good that would do us even if we had it on Super User; unless I’m missing a trick, it’s too much work to enter the data that way.

1
  • While I personally find this process adequate, I suspect many users won't have knowledge of a terminal, much less access to column. It would be sensible to have a more accessible option: For that matter, I'd like to see markdown syntax for tables implemented by SE sites. The formatting could be made to look as you've shown, plus the actual text could have "invisible" tab or space separators or something to allow easy importing into a spreadsheet.
    – jpaugh
    Jun 21, 2016 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .