Untitled
unknown
python
a year ago
689 B
5
Indexable
import realm import csv # Replace 'your_realm_file.realm' with the actual Realm file name realm_file = 'your_realm_file.realm' # Connect to the Realm database realm_db = realm.open(realm_file) # Replace 'your_table_name' with the actual table name table_name = 'your_table_name' # Fetch data from the Realm table data = realm_db[table_name] # Replace 'output.csv' with the desired CSV file name csv_file = 'output.csv' # Write data to a CSV file with open(csv_file, 'w', newline='') as csvfile: csv_writer = csv.writer(csvfile) csv_writer.writerow(data[0].keys()) # Write header csv_writer.writerows([row.values() for row in data]) print(f'Data exported to {csv_file}')
Editor is loading...
Leave a Comment