I can read/write a open excel file by Anne’s way,but how can I read/write a excel with path?
I tryed
open_dde_conversation(‘Excel’,‘D:\swi_work\dde\[111.xlsx]Sheet1’,C),
or
open_dde_conversation(‘Excel’,’[D:\swi_work\dde\111.xlsx]Sheet1’,C),
and so on,but fail all.
Is there any other way to read/write excel files?
You can’t read/write excel files with DDE directly. The file have to be open in the Excel application already and you have to use proper topic, not the path.
There is no proper excel library for prolog yet. At least non that I am aware of.
For reading only you could convert excel workbook to odf and use Jan’s odf_sheet pack.
For both reading and writing you could use JPL interface to Java and use Apache POI library for excel.
This is probably the most convenient way for ready made library I have used to stay as much as possible on prolog side.
And finally, the xlsx format is just a zipped group of XML files, so you coud read file from archive with libarchive library and then process it with SGML/XML parser.
This is the way I am currently working on these days.
Thanks.
At last,I change excel files to csv files, and use library(csv) to read/write them.
By the way,a cell data in excel would be [[100,200],[100,3]] ,it’s list,can’t directly write by csv_write_file.
So use term_to_atom/2 ,change list to atom ,then can write by csv_write_file.
Then I use Excel open csv files.