Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Display data from a specific cell in google sheet on a page.


BernardoDesigns

Question

2 answers to this question

Recommended Posts

  • 1

What you want is doable. Although a bit involved. In general and in its simplest form you need a Google sheet that is public. The Google sheet id and a Google API Key set up to access the Google Sheets API.

Then in a code block you'd do something like the following. I'm using Javascript/jQuery here.

<div id="specific-cell-from-google-sheet">

  </div>
  
<script>

  ( ( ) => {
  
    const googleApiKey = '[enter google api key]';
    
    const googleSheetId = '[enter google sheet id]';
    
    const googleSheetName = 'Sheet1';
    
    const googleSheetRange = 'A1';
    
    const googleSheetsApiUrl = 'https://sheets.googleapis.com/v4/spreadsheets';
    
    const url = googleSheetsApiUrl +
    
      '/' +
      
      googleSheetId +
      
      '/values/' +
      
      googleSheetName +
      
      '!' +
      
      googleSheetRange;
      
    $.getJSON ( url, { key : googleApiKey }, function ( data ) {
    
      $( '#specific-cell-from-google-sheet' ).text ( data.values [ 0 ] );
      
      } );
      
    } ) ( );
    
  </script>

These are not instructions about how to do something specific but a guide on one way a particular goal might be reached.

There is voluminous information on the web about the elements involved.

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to comment
  • 0

You can publish the spreadsheet in html format and use ajax to fetch for its data, using a javascript snippet

Greeting, it's BaNgan from BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Portfolio hover Replace Link Style
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...