Google Sheets API: Import Data to Xano

Options
Michael Udinski
Michael Udinski Administrator

ADMIN

edited July 2023 in ✂️ Snippets

Hi all!

I just launched a new Snippet and tutorial, which covers importing data from a Google Sheets spreadsheet to Xano via the Google Sheets API.

There are a lot of variables and nuances that can go into this depending on your spreadsheet format and size. This Snippet and tutorial are designed to give you an educational foundation so you can consider what to look out for and adapt the logic in your function stack depending on your use case.

The Snippet is available here 👇️

https://www.xano.com/snippet/3n5ZDjgw/

The tutorial can be viewed on YouTube or below 👇️

Comments

  • Inayet
    Inayet Member
    Options

    Hello @Michael Udinski , so now we can import the workspace exports? If yes, then that is really cool

  • MarkH
    MarkH Member
    Options

    Hi there, followed this on video instead of downloading the snippet and it works great :)

    What I need to know is 'how to append the API to just fetch 10-20 random rows when the app first loads, instead of fetching all 150,000 :)

    The App is mainly a TAX search data base so the primary function is search and not product display, but would be nice to load a random set of 'info'

    Thanks Mark

  • MarkH
    MarkH Member
    Options

    Hi there, can anyone help with the correct path to just search and append to a specific sheet using this method in the video above, it all works perfect but Xano is adding users to the spreadsheet under a new tab and then Draftbit is adding this detail in the search results.

    https://sheets.googleapis.com/v4/spreadsheets/%s?fields=sheets(data(rowData(values(formattedValue))))

    I just need to get the data from the first sheet.

    TIA Mark.


  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    Hi @MarkH — things do change depending on the use case. Google Sheets API does have an append cells API that might do the trick.
    (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#appendcellsrequest).

    Alternatively, if you know exactly where you want to add you may be able to use the range parameter to start adding at a specific place - this may require you to get the sheet data first. Sheets API is certainly a bit tricky but comprehensive because of how many possibilities there are that can go into a sheet so it might take a little trial and error

  • MarkH
    MarkH Member
    Options

    Thanks Michael, I stopped the 'tab' being created in the spreadsheet as I thought this would be a more robust solution.