I have been using the same sheetrock code for a while now to query my google spreadsheets. (Different spreadsheets on various sites, etc.) For some reason that I am unsure of this time, I get a callback error "SheetrockError: Request failed". Not sure what I am doing wrong.
I've tried searching around on stack overflow and the Sheetrock Github Repo and even opened an issue there to no response.
Here is my JS code:
var mySpreadsheet = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vSkcN_ec394URPCLiZ5R5YD3qTS65Q9oUken30dhFhm_rLVYftuFc9h9DPuWqtrgz1m27zVVVuEOfQE/pubhtml?gid=585428784';
var bandsTemplate = Handlebars.compile($('#bands-template').html());
function loadResults() {
$('#bands').sheetrock({
url: mySpreadsheet,
query: "select A,B,C,D,E,F,G order by A asc",
rowTemplate: bandsTemplate,
callback: function(error, options, response) {
if (!error) {
$('#bands').tablesorter();
}
else {
console.log(error);
}
}
});
}
loadResults();
Here is my HTML code:
<div class="table-responsive">
<table id="bands" class="table tablesorter">
<thead>
<tr>
<th class="col-xs-1">Song<br>Name <i class="fa fa-sort fa-fw" aria-hidden="true"></i></th>
<th>Band <i class="fa fa-sort fa-fw" aria-hidden="true"></i></th>
<th>Arranger <i class="fa fa-sort fa-fw" aria-hidden="true"></i></th>
<th>Date <i class="fa fa-sort fa-fw" aria-hidden="true"></i></th>
<th>YouTube Link <i class="fa fa-sort fa-fw" aria-hidden="true"></i></th>
<th>Notes <i class="fa fa-sort fa-fw" aria-hidden="true"></i></th>
</tr>
</thead>
<script id="bands-template" type="text/x-handlebars-template">
<tr>
<td><a href=""></a></td>
<td></td>
<td></td>
<td></td>
<td><a href=""></a></td>
<td></td>
</tr>
</script>
</table>
</div>
I've also set my code up in a JS Fiddle link for easy previewing (with the Sheetrock and jQuery plugins already linked in).
My expected result is to have the sheetrock plugin successfully call the spreadsheet using the code provided.
Safari also gives these two errors:
[Error] Failed to load resource: the server responded with a status of 404 () (tq, line 0)
[Error] Refused to execute https://docs.google.com/spreadsheets/d/e/gviz/tq?gid=585428784&tq=select%20A%2CB%2CC%2CD%2CE%2CF%2CG%20order%20by%20A%20asc&tqx=responseHandler:_sheetrock_callback_0 as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
from "SheetrockError: Request failed" but no further detail
No comments:
Post a Comment