Jump to content

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

Recommended Posts

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

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

Greeting, it's 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, Lightbox Studio plugin
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...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.