That’s an unusual way to use the CSV export feature of sheets… I can see that because you have no header row, and only the one populated cell, it emits the cell content by itself. Semi-useful, but if you’re doing this to make life easier for a client, consider locking that sheet down tight so that only the one cell is editable. If they accidentally put anything in another cell, your output will be a delimited CSV chunk.
Without setting up a demo, I’d suggest these things;
Your jQuery selector appears incorrect, change it to $('#texthere') You want to select the element with that ID, not the element(s) with the class texthere
.val() is generally used with FORM elements to set their value property. Here it looks like you have a text element, so try using .text() or .html() to set that inner content.
You’re using jQuery, and accessing elements before the page may be fully rendered. Try putting your code in an on-ready function.
<script>
$(function() {
... your code here ...
});
</script>
Are you getting the content you want into your value? Verify that, using console.log(...) and check the developer tools output.
If you’re calling your code after the page is loaded (see #1), you shouldn’t need the Webflow.push. Just set your value.
Just be cautious, on the web functionality is heavily affected by browser choice, your cached content, and your network situation. Someone on a slower connection could get a different load/execution timing, which would execute your code before the jQuery library is loaded.
<script>
var Webflow = Webflow || [];
Webflow.push(function() {
// DOMready has fired
// May now use jQuery and Webflow api
fetch('**https://docs.google.com/...&output=csv**')
.then(function(response) { return response.text() })
.then(value => {
$('#**ID**').text(value);
});
});
</script>
@memetican - The code can be run anywhere is the main one.
Danro explains it as
Hi @gvdias , the Webflow.push wrapper is only necessary if you plan to place your code in the Head Code block, or within a code embed element in the Webflow Designer.