Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Google Sheets Cell values for Variable
brendon_prentice
Member Posts: 5 ✭
Hi Team,
I am brand new to onshape and testing out the functionality.
Can I get variables from a google sheet?
A simple example would be cells with the values 200 and 400
These cells are some how referenced in onshape to create a rectangular sketch that is 400x200.
I have searched the forum and there are a few mentions of this feature in demand from many years ago.
I have the variables set in my model and I have linked the google sheet into my model via the Link Tab
I just can't get onshape to suck the values out of the sheet and apply them to the model.
Thanks in advance
I am brand new to onshape and testing out the functionality.
Can I get variables from a google sheet?
A simple example would be cells with the values 200 and 400
These cells are some how referenced in onshape to create a rectangular sketch that is 400x200.
I have searched the forum and there are a few mentions of this feature in demand from many years ago.
I have the variables set in my model and I have linked the google sheet into my model via the Link Tab
I just can't get onshape to suck the values out of the sheet and apply them to the model.
Thanks in advance
0
Best Answers
-
Matt_Shields Member, Onshape Employees Posts: 419Not natively. You could paste in values from a Google Sheet. Or write a python script to read the sheet and update your document via the API.0
-
Matt_Shields Member, Onshape Employees Posts: 419I'm by no means an expert, but I got a little test working. I started here:
https://developers.google.com/sheets/api/quickstart/python
I followed that exactly. Once I had my Python code reading my Google Sheet, then I just updated a Variable Studio using Python requests to the Onshape API.
By the way, after I was done, I also found this:
https://github.com/PTC-Education/PTC-API-Playground/blob/main/Configuration_Variables_and_Google_Sheets.ipynb
2
Answers
Does the python sheet get written in Onshape or google, Is there any great help resources for this or potentially someone that may be able to help in this regard.
https://developers.google.com/sheets/api/quickstart/python
I followed that exactly. Once I had my Python code reading my Google Sheet, then I just updated a Variable Studio using Python requests to the Onshape API.
By the way, after I was done, I also found this:
https://github.com/PTC-Education/PTC-API-Playground/blob/main/Configuration_Variables_and_Google_Sheets.ipynb