Import CSV or Excel Data into Excel

import
ruby
csv
rubyapi
excel

#1

Hey guys, Im trying to import data from csv or excel files into sketchup and then assign that data to objects.
for example xyz coordinates and set an object at the imported positons…or angles for rotation?

I have recently started learning ruby and have been searching for plugins to replicate this

would appreciate any tips if anyone has any :sweat_smile:

thanks :grinning:


#2

Hmm… I’m not sure if there’s anything out there doing exactly what you describe. There are certainly extensions that use CSV and similar to import data. But it’s a bit unclear to me exactly how “assign that data to objects” would be done.

Can you elaborate more in a high level of what you want to do?

Sounds like you have source data with position for object, then apply that to some “objects”. I assume these object will be groups or components. Would the CSV contain the name of the component to position?
Then there is the question, what do you do if a component have many instance? What is the instance is deeply nested in another group or component?

By the way, to read CSV file specifically, Ruby have support for that in the StdLib: https://ruby-doc.org/stdlib-2.2.0/libdoc/csv/rdoc/CSV.html
Should cover most scenarios of reading/writing.


#3

There have been previous requests on how to do this in this very forum category (not that long ago.)


#4

thanks for the reply tt

Ok I will try and elaborate as best as i can

so basically you get what I am trying to do

I have a source file with various data, such as x y z positions and and angles for rotation…amongst other information. for this particular task i would like sketchup to take the rotation angles and apply them to a range of components…in the source file that I have the components are named and each x y z location corresponds to a component

hope this was helpful


#5

Tip 1: Use the magnifying glass icon at the top right to search a forum category (when in a category) for terms such as “CSV” or “Excel” (omit the quotes.)

Tip 2: You need to at least TRY to solve your challenge yourself. If you have problems with some code, then post the code you have tried, and ask specific questions about the errors you are encountering.


#7

As said, this has been discussed recently here (as you’ll see if you search this category. See link above.)

Other than this …


#8

thanks Dan


#9

If you show us what you have so far, post a snippet here and we can guide you further.