Excel to Unicode file


Is there a way, with Dynamo, to save a excel file as a Unicode file, and load it in the project at a keynote file??

It can also be with python, if that is an option. I just can’t find anything helpfull anywhere. :disappointed_relieved:


import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import codecs

fullpath = IN[0]

with codecs.open(fullpath, mode = 'w', encoding = 'utf-16') as f:
OUT = fullpath

Code of second python node:

#credit https://forum.dynamobim.com/t/load-assemblycodetable-keynotetable/23944/2

import clr
from Autodesk.Revit.DB import*

from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

filepath = IN[0]

p = ModelPathUtils.ConvertUserVisiblePathToModelPath(filepath)
s = ExternalResourceReference.CreateLocalResource(doc, ExternalResourceTypes.BuiltInExternalResourceTypes.KeynoteTable, p, PathType.Absolute);


KeynoteTable.GetKeynoteTable(doc).LoadFrom(s, KeyBasedTreeEntriesLoadResults());


OUT = s



I think there is something wrong.
My script look like this:

Plus index 1 look differently, any idea why??

But the keynote file look like this:

Can you help my understand why??

Is your data in Excel structured like this? Otherwise it will go wrong


Okay, it’s still comes out differently then yours.


I start differently then you in the beginning, but take a look, and see if you can tell my where it goes wrong. Thanks. :smiley:
G1_Keynotes from BDJ.dyn (74.5 KB)

You can maybe send me your script, to see if that’s works on my computer??

I can’t replicate your issue, because it stems from the structure of Excel-file or reading of the data from Excel-file. Delete everything in your layout and just leave two columns with the code and text respectively. No headers, just the data, like in my example if it still doen’t work share a sample of your Excel-file. I’ll look into it.

Still the same. :disappointed_relieved:

Can you send me yours??

test.xlsx (94.3 KB)
test.dyn (15.7 KB)

Maybe the issue is in the multi-line text that you use in excel. Don’t think the script will work with that.

1 Like

Make sure there isn’t any space or tab or anything in any cell in Excel. I think @fluffyhugger is right that the return “\n” for the multiline text is causing the issues.

It is, the reason. Do you have an idea on how to change that?

I think you just need to turn off “Text Wrap” in your excel file.

It’s still don’t work, maybe it’s not possible with more lines in the same cell. :neutral_face:

Can you make an Python Script, there instead of overrite and existing TXT file, makes a new one?
Because if you open Excel and save as, and choose “Unicode-text (.txt)” and insert that as a keynote file, it’s works.
So if you can get python to do the same, it should work.

Is there really no way to solve this??
A python script there take an Excel file, “press” save as, and save as and txt file. No overrite, just save.??