Speckle with Google Sheets

Is anyone working to connect Speckle with Google apps? I see the Speckle-Excel install, but I’m also looking to integrate with Google Sheets.

Hello @StephTabb, after some struggles, i’ve managed to receive into a google sheet.

Base stream & query: https://hestia.speckle.works/api/streams/AldkiWxNH/objects?fields=properties.area,properties.centre.value

The process:

  1. I’m sure google sheets have an importJSON or similar function, it’s almost 2020.
  2. Nope they don’t. C’mon Google, only csv, and xml?
  3. Find this repo online that provides the functionality. Great!
  4. Copy paste the code the raw file provided into google’s script editor.
    4.a) To find the script editor, first go to your google sheet, then click on tools in the menu
    4.b) Select script editor
    4.c) Paste the code
    4.d) Save
    4.e) You can now just return to the spreadsheet!
  5. Call the now available importJSON function with your speckle url.
  6. Profit:

Hope this helps. Also, for the generic issue, i’ve added a card to our roadmap. Don’t hold your breath though, there’s quite a backlog and other noise.

2 Likes

I have been working on a temporary alternative solution to enable read/write functionality from multiple users using Grasshopper.

First, I followed the instructions from this thread to create custom python components that can read and write to Google Sheets: Google sheet read with gh - Grasshopper - McNeel Forum

While these components work fine, every system that uses them requires a lengthy install, which is undesirable in my circumstances.

So, I created a GH file with the Python read write components, which receives and sends data via Speckle. This way, another user only needs to access a speckle stream in order to send or receive data from Google Sheets, rather than install the Python components. Here is a diagram to explain the logic and a screenshot of the correct data being sent/received:


The solution works, but there is an issue with how it updates. It seems as though the Grasshopper file containing the Python components needs to be open in order for it to work. I’m assuming that the GH document with the Python components can simply live on a Speckle server without being open and still enable the data transfer back and forth, is this not correct, or is there something particular about this situation that stalls the data flow?

Any help would be appreciated, and let me know if anything is unclear, thanks!

1 Like

Hi Patrick! Thanks for reaching out! I’m not sure I’m understanding correctly but, as far as I know, you’re going to have to keep that Grasshopper file open in a computer in order to enable data transfer back and forth, as the Speckle server doesn’t have the ability to “run” Grasshopper definitions by itself.

If you wanted to be able to run grasshopper definitions on the cloud, there are other technologies that might do the trick. Have you tried Swarm? Announcing…Swarm! | CORE studio

Also, McNeel is working on their own solution called Rhino.Compute, which is basically a headless Rhino/Grasshopper you can run remotely. https://www.rhino3d.com/compute

I hope this helps! :crossed_fingers:

2 Likes

That does answer my question, thanks, and I’ll check out the links your provided to see if they can be used to solve the issue.

3 Likes

@dimitrie have you had any luck with sending from google sheet? Is this something that was added to Speckle 2.0?

Hey @eugene thanks for checking in on this!

We haven’t created a connector for Google Sheets yet and for the time being it’s not on our roadmap - our focus is reaching feature parity with v1.

But the good news is that sending and receiving data is super easy with our new v2 API.
See example AppScript functions to create a stream or get the current user:

function createStream() {
  let  url ="https://staging.speckle.dev/graphql"
  let graphql = JSON.stringify({
      query: `mutation streamCreate($myStream: StreamCreateInput!) { streamCreate(stream: $myStream) }`,
      variables: { 
        "myStream": {
            "name": "Sample Stream",
            "description": "Created from Google Sheets!"
          } 
      }
    })
  let params = {
    method: 'POST', 
    payload: graphql,
    headers: { 
      'Content-Type': 'application/json',
      'Authorization': 'Bearer PERSONAL_TOKEN_HERE'
      }
   }
  var response = UrlFetchApp.fetch(url,params)

  Logger.log(response);
}


function getMe() {
  let  url ="https://staging.speckle.dev/graphql"
  let graphql = JSON.stringify({
    query: `query User {
                      user{
                        id,
                        email,
                        name
                      }
                    }`,
      variables: null
    })
  let params = {
    method: 'POST', 
    payload: graphql,
    headers: { 
      'Content-Type': 'application/json',
      'Authorization': 'Bearer PERSONAL_TOKEN_HERE'
      }
    }
  var response = UrlFetchApp.fetch(url,params)

  Logger.log(response);
}
1 Like

Thanks @teocomi. I will give it a try.

1 Like