That's excellent! Excel allows both importing from XML and JSON both of which can done using FDMemtable.SaveToFile method. ( SaveToFile documentation )
I created an XML file using the SaveToFile method and then tried to import that file into Excel.
That didn't go so well. Where's my data? I'm starting to feel that "I hate Delphi" thing happening again! Let's try JSON. So. I created a JSON file using the SaveToFile method and then tried importing into Excel.
"I just want the data in Excel."
That didn't go so well either. I've imported text files hundreds of times into Excel and it just worked. I wasn't in the mood to figure out what was going on. I'll save that for another day. I just want the data in Excel.
"I know CSV works. Let's find a solution."
I know that text or csv files import just fine into Excel so let's see how to create a CSV file using Delphi. A quick google search turned up exactly what I was looking for, a simple solution written by Uwe Rabbe six years ago. Thank you Uwe!
[Archive]
This works with any TDataSet descendent! And just like that I love Delphi again.
Gunny Mike
https://zilchworks.com
Feedback is always appreciated!
Actually my thought would have been "I hate Excel" rather than "I hate Delphi", because Excel suggests that it can read any JSON or XML but it simply can't, which your experience just showed.
ReplyDeleteI totally agree with twm ;)
ReplyDeleteWhere can I order one...
ReplyDelete