Hi!
You probably want the CSV extension.
The name of Table extension may be misleading. It’s not about dat tables, like spreadsheets or CSV files. It’s key-value pairs, like JSON or dictionaries in other languages.
Also: If you want to write out a report of columns of data, you can always simply use type and print, or the file versions, or build up a string and print or save that at once.
To-report column [ value width ]
;;;; returns the value followed by spaces
;;;; so the result is ‘width’ characters
let spaces “(15 spaces, more if needed)“
Report ( word substring ( word value spaces ) 0 ( width - 1 ) “ “)
End
To print-turtle-report
Let vars [
[ “who” 3]
[ “xcor” 5]
[ “ycor” 5]
]
;;;; print column headings
( Foreach vars [ v ->
Let name first v
Let width last v
Type column name width
] print “”
;;;;; print column values
Ask turtles
[
Foreach vars [ v ->
Let value runresult (first v)
Let width last v
Type column value width
] print “”
]
This can be modified to handle both left and right-alignment, delimiters, or table borders.
Note also, you can also print html tables with similar code.
Let html-first [
“!DOCTYPE html”
”<html><head>”
“<title>Turtle Report</title>”
“</head>“
“<body>”
“<table>”
]
Let html-last [
“</table></body></html>”
Let html-mid “”
;;; modify above to wrap columns in <td> and rows in <tr>, but as a string
;;; then display or save the string.
~~James