sheetrock icon indicating copy to clipboard operation
sheetrock copied to clipboard

Unexpected behavior regarding header rows

Open dav1dn opened this issue 10 years ago • 3 comments

Sometimes, on some spreadsheets there will be one of two issues with the first row returned in response:

  1. First row is omitted altogether. This can be seen in one of the given examples: https://jsfiddle.net/p1kxjwgq/. Note that in the source sheet (https://docs.google.com/spreadsheets/d/1qT1LyvoAcb0HTsi2rHBltBVpUBumAUzT__rhMvrz5Rk/edit#gid=0), the labels should be Team, Pos, etc but instead it skips straight to the first player.

    Curiously, with the 'query' option example using the same spreadsheet, the column labels row is shown correctly: https://jsfiddle.net/7krs6q0q/ . Remove the 'query' option and rerunning it will cause the column labels row to go missing again.

    I think I discovered a fix of sorts for this, which is by removing all empty columns to the right of any data. This, for some reason, restored the proper columns in the above, first example. However, doing this may lead to the second issue:

  2. First and second rows are concatenated by column so that every column in the header row contains the contents of the first two rows.

    Using this SS: https://docs.google.com/spreadsheets/d/1nZxNBCo5LQIQ7ATLCen-1L5tk9V1zx67-xM13Ft_aOw/edit#gid=0 yields this result: https://jsfiddle.net/r0hywmfx/

    Also very curiously, this seems to only occur when you add a new row between the header and the second row. No matter what data is inputted into this new row, it will be displayed along with the header row in the response object. If I keep this new row and shift an old row above it, it will again be displayed properly.

dav1dn avatar Oct 13 '15 21:10 dav1dn

I can confirm that I had this same issue with the first row of data (after the header) was being omitted from what was pulling into my website. Doing what emesde suggested in deleting the extra columns to the right fixed the problem for me. Thanks!

dtwsolutions avatar Jan 20 '16 04:01 dtwsolutions

Hi, I have also a problem to show the first row as header.

/* Define spreadsheet URL. */
var mySpreadsheet = 'https://docs.google.com/spreadsheets/d/1kPTIf-XZRvfLAzVbtDqKg2W7Uzg60yutfSQrsD_A7Hc/edit#gid=X';
var myQuery = "select B,C,D where A = 'ja'";

jQuery('#statistics').sheetrock({
  url: mySpreadsheet,
  query: myQuery
});

Here is my Spreadsheet: https://docs.google.com/spreadsheets/d/1kPTIf-XZRvfLAzVbtDqKg2W7Uzg60yutfSQrsD_A7Hc/edit#gid=X

Also the deleting all right columns have no positive change on my example.

janstieler avatar Jun 08 '17 23:06 janstieler

I am running into the second issue in the original post. Has anyone found a solution? It seems to happen only on my spreadsheet when I am using a =QUERY() function for the data.

dustinkerstein avatar Mar 28 '22 03:03 dustinkerstein