Search Unity

Unity Excel Integration

Discussion in 'Formats & External Tools' started by lordsterben, Aug 23, 2019.

Thread Status:
Not open for further replies.
  1. lordsterben

    lordsterben

    Joined:
    May 14, 2015
    Posts:
    5
    Hi!

    I have an Excel spreadsheet with a list of items I have in a scene. There are thousands of them, each with a different ID. Some of them are new, some of them are old. My task is to sort them in the hierarchy and to place them in 2 different game objects based on their status. The spreadsheet has the new ones. Is there a way to import the Excel file, read the first column with the ID, and based on that sort the items in there?
    I could also export the Excel as a CSV and then use that, but how can I sort the hierarchy automatically?

    Thank you!
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    narusuke15 and Antypodish like this.
  3. lordsterben

    lordsterben

    Joined:
    May 14, 2015
    Posts:
    5
    @mgear thank you for the sources. Do you have any idea if the hierarchy can be sorted using my own algorithm?
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    can you give some example rows, and how it should look like (after sorting)?
     
  5. lordsterben

    lordsterben

    Joined:
    May 14, 2015
    Posts:
    5
    Yes. In the spreadsheet the first column has 4 digit codes like {bibl, xida, t123, kg23}. In the scenes there are gameObjects with the name A4. All of them have the same name, none of them are parented to anything. All objects have a material attached that has the a code made of 4 digits, like I showed earlier. What I would like to do would be to go through all objects in the scene, get the material, check if the name is found in the sheet. If it is, nest it under object currentMaterials, if not then nest it under archivedMaterials.

    Hmm.. writing this made me think of a possible solution. I'll get to it and come back with an update.
     
  6. lordsterben

    lordsterben

    Joined:
    May 14, 2015
    Posts:
    5
  7. lordsterben

    lordsterben

    Joined:
    May 14, 2015
    Posts:
    5
    I figured it out, I made a test project and it worked, I now need to try on the main data. Thank you!
     
    mgear likes this.
  8. Tom_Black2

    Tom_Black2

    Joined:
    Jul 29, 2020
    Posts:
    1
Thread Status:
Not open for further replies.