DynamoDS / Dynamo

Open Source Graphical Programming for Design
https://dynamobim.org
Other
1.72k stars 632 forks source link

Reading numbers from excel #4415

Closed ondejcik closed 9 years ago

ondejcik commented 9 years ago

Hi,

i have problem with component that reads excel data, it autoaticaly converts numbers to float without chceking if they are intergers, and adds a lot of zeros.

it looks weird when i write values to to revit components that go out on sheets

would it be possible to have component that consideres all data from excel as string ? so the values look exact as in excel? there already is component string to number that could take hand of numbers if needed,

thanks

image

monikaprabhu commented 9 years ago

@aparajit-pratap ,Why are we converting the int into float? how can we keep the value same as entered in excel

aparajit-pratap commented 9 years ago

Let me check this. Thanks for pointing it out. This is being tracked by: http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-7347

aparajit-pratap commented 9 years ago

@ondejcik all numbers in Excel files are read as floats by Excel by default. It is not worth CPU time to check if a number is meant to be an int, then returning it as an int and if it is meant to be a float, returning it as a float. This can make reading Excel files even slower than Excel interop already is. There is however a workaround you can use. If you expect all values in the file to be integers, you can change the number precision in Dynamo. Go to Settings => Number Format. Change its value to 0.

ondejcik commented 9 years ago

ok but is it not possible to read from excel all text and numbers as string ? it would solve my problem, i have both floats and integers in excel and i need to pass the to revit as string anyway.

monikaprabhu commented 9 years ago

@ondejcik , Which Revit node are you using to write into sheet?

aparajit-pratap commented 9 years ago

@ondejcik yes it is possible to read from excel as strings. That way you will get the data exactly as you see it in the excel file however in Dynamo the ReadFromFile node is meant to read strings as strings and numbers as numbers so that users can use those numbers and perform further computation with them. We will evaluate whether it would be useful to add a new Read node to Excel to read all data as strings and get back to you.

Btw, could you tell us which Revit node you are using to write data to it?

Additionally if you run the graph below, you will see that the Write node actually writes the data in the same format as read from the original excel file. image

ondejcik commented 9 years ago

@aparajit-pratap @monikaprabhu

my definition looks like this: (in short; i read excel, pick some cells i need and write them to parameterslots in families in revit, (tree data, 200+ parameters) then all data show directly to revit sheets (via revit schedules ) and that is why i need them to look same as in excel, all parameters in revit are generated automaticaly and contain string data)

thanks!

image

aparajit-pratap commented 9 years ago

@ondejcik This is fixed here: https://github.com/DynamoDS/Dynamo/pull/4548

Let us know what you think.

ondejcik commented 9 years ago

Hi,

Thanks for implemetation in a first place. However i have still one probem. I got an error when i a reading my excel file with true setting on. I wonder where culd be an error. I would guess it does not like empty fields.

case 1

Works image

does not work image

used excel:

image


it works if the are no empty cells

case 2

image

used excel image

aparajit-pratap commented 9 years ago

@ondejcik thanks for pointing this out and sorry for the oversight. This is now fixed in: #4572