Hey Team,
I feel like this is so easy that no one has asked there for no posts when i search.
Writing table data to an xml file, do i need to import a library like ElementTree from Python or can TD do it natively?
Many thanks
Hey Team,
I feel like this is so easy that no one has asked there for no posts when i search.
Writing table data to an xml file, do i need to import a library like ElementTree from Python or can TD do it natively?
Many thanks
You’ll need to import a module to help you export to XML. Natively Table DATs can be exported to .JSON, .csv or .dat format.
You can read it back in using the XML DAT though.
Thanks nettoyeur, I haven’t used the JSON export before. Is it documented somewhere?
See here: TDJSON - Derivative
Awesome, I think. Have you used this before / have an example?
Trying to convert a table like this:
ID Active Location
1_1 1 "C:\test\1_1.txt"
1_2 0 "C:\test\1_2.txt"
1_3 1 "C:\test\1_3.txt"
1_4 1 "C:\test\1_4.txt"
1_5 0 "C:\test\1_5.txt"
into an external file. that would be read by another program.
apologies @UKOneMoreThing - I see now that the TDSJON.datToJSON()
method only supports:
Turn JSON text stored in a DAT into a JSON Python object
so this would not fly for your case as you don’t have JSON in your Table DAT.
So probably best to just write a few Python lines to iterate over the table rows and write them to the format of your choice.