Reference for write_csv
Write a list of dictionaries as a CSV file. This is part of the reference section.
Arc
Buffer
Data
write_csv
Dialog
Ellipse
Geo Utils
Image
Joystick (future)
Keyboard
Line
Mouse / Touchscreen
Pixel
Rectangle
Renderers
Shape
Sound (future)
Style
System
Text
Transform
Purpose
Write a CSV file with header row, saving it to local file system or offering it as a download in the browser.
Snippet
Write a two row CSV file called example.csv.
records = [ {'group': 'a', 'value': 1}, {'group': 'b', 'value': 2} ] sketch.get_data_layer().write_csv(records, ['group', 'value'], 'example.csv')
Parameters
- records: List of dictionaries to be written.
- columns: Ordered list of columns to include in the CSV file.
- path: The location at which the file should be written.
Examples
Availability
Available for all platforms. On static and app renderers, will interpret path as a local file path using the operating system's conventions. For web, it will interpret path as a filename to use when dowloading the result.