Comments (12)
Sometimes Google Spreadsheets automatically withholds the header row (usually when the user has employed "View > Freeze rows...") and sometimes it doesn't. The trouble is that it doesn't pass any reliable indicator of whether this is the case. It's hard to tell the difference between data and column labels.
I've made an option available (actually I repurposed one that wasn't doing much of anything) to address this issue. By default, Sheetrock will treat the first returned row as the header row. Alternatively, you can tell it to treat the column labels as the header row. Do this using the "header" option:
var myOptions = { url: [...], header: true };
$('#statistics').sheetrock(myOptions);
I've updated the JSFiddle to use this new option.
http://jsfiddle.net/DymcL/1/
from sheetrock.
Well that's what I thought that option did..."do we have a header"
from sheetrock.
You must think I'm a nutjob:)
Anyway now the original spreadsheet (eg the test one) doesn't display header info only column titles like A B C etc
https://docs.google.com/spreadsheet/ccc?key=0Ag1L9aBNT9eNdEJoOF9vQks4SUxKVHlOOUk3VjVVQWc#gid=0
I've made it public for now
from sheetrock.
No, I really appreciate the testing you are doing. I haven't been able to test it on a wide variety of spreadsheets so this is really, really useful. I'll take a look at this soon.
from sheetrock.
I took a look. It's working correctly, you just have to adjust the header
option accordingly:
What I was trying to say above is that Sheetrock is unable to automatically figure out whether Google Spreadsheets has identified a header row. So it's up to you to test and supply a header
option if necessary.
Here's what I'd suggest. First try it without the header
option (the default is false
). If you find that the header row is omitted, supply a header
of true
. Does that make sense?
from sheetrock.
Here's an updated JSFiddle that might help explain things better:
from sheetrock.
:)
Ja makes sense (sort of) however I've edited the fiddle to demo what I mean.
So I need to identify if the ss has a header row and as you say turn on/off the header option?
That's a bit annoying but not a major headache...
I'll look into it later myself as I'm busy on other stuff right now:(
from sheetrock.
My view would be if header is on then row 1 wouldl be the header? that would suit me:)
from sheetrock.
OK here's my idea for what it's worth:
The header option tells the module to treat x numbers of lines as the header with zero as the default, so if header : 2 then the first 2 lines are the header lines, if it is zero then the column names (A/B/C etc) are the column titles...
What do you think?
from sheetrock.
That's a good approach and I've implemented it (but we're back to using headers
instead of header
). The only caveat is that if Google has identified a row as a header row and uses it for the column labels, you can't override it with headers: 0
.
I think it works well and is reasonably intuitive. Let me know what you think.
from sheetrock.
yeah just tried it out seems to be ok, One table outputs the column names and the other A/B/C etc. I think it's a reasonable compromise myself...now on with what I really want to do:)
Not sure how google identifies a row as a header though...
from sheetrock.
I believe it's triggered by "View > Freeze rows...". At least that's the correlation I've seen.
Thanks for the suggestion.
from sheetrock.
Related Issues (20)
- Select newest records that have distinct Name column
- Conflicts with Table sorter?
- Few header title aren't display HOT 1
- Example using Node.js HOT 1
- Sheetrock possibly returning nothing to Handlebars function
- how to pass the output to a chart?
- Header row showing in results HOT 3
- Adding handlebars context?
- SheetrockError: Request failed.
- using index.js and formatting cell entries
- Trouble sorting with double named cells
- Column order changes when first row contains only numbers
- Fetch Size sometimes fetches 1 more row than requested
- Using datatables with sheetrock yields Uncaught TypeError HOT 3
- No longer working HOT 3
- Uncaught TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator)) HOT 1
- Move through records
- The data table do not display with search & sorting filters HOT 5
- Is it possible to modify the google sheet if it has pubilc write access?
- Unknown TypeError: t is null
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sheetrock.