# Simple Recordset Export routine

**URL:** <https://forum.xojo.com/t/simple-recordset-export-routine/58350>\
**Category:** Getting Started\
**Created:** [October 30, 2020, 4:23pm UTC](https://forum.xojo.com/t/simple-recordset-export-routine/58350 "2020-10-30T16:23:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jim\_McDermott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/ec9cab/32.png) [@Jim\_McDermott](https://forum.xojo.com/u/Jim_McDermott)\
**Post date:** [October 30, 2020, 4:23pm UTC](https://forum.xojo.com/t/simple-recordset-export-routine/58350/1 "2020-10-30T16:23:39Z")

</div>

I have a Mac application with an SQlite DB. I would like a simple method to export a recordset to a file that can be read into excel. (e.g CSV)

I do not not have or want to pay for Plugins.

Thanks  
Jim

---

<div class="post-metadata">

**Author:** ![Paul\_Budd](https://forum.xojo.com/user_avatar/forum.xojo.com/paul_budd/32/799_2.png) [@Paul\_Budd](https://forum.xojo.com/u/Paul_Budd)\
**Post date:** [October 30, 2020, 7:05pm UTC](https://forum.xojo.com/t/simple-recordset-export-routine/58350/2 "2020-10-30T19:05:27Z")

</div>

You don’t need a plugin for this. Create a method that iterates your database, and for each record concatenate a string separated by commas. For text fields wrap them in quotes, numeric fields no quotes etc. Write the string to an open text file with the extension .csv.

---

<div class="post-metadata">

**Author:** ![Matthew\_Dinmore1](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@Matthew\_Dinmore1](https://forum.xojo.com/u/Matthew_Dinmore1)\
**Post date:** [October 30, 2020, 9:31pm UTC](https://forum.xojo.com/t/simple-recordset-export-routine/58350/3 "2020-10-30T21:31:35Z")

</div>

Be advised this may not work for Excel without a few other things, if that’s your target. A few gotchas…

- you’ll need to escape quotes within quoted fields
- you’ll need to watch text field length – anything around 32768 (slightly shorter in my experience) will cause a line break and new record
- Excel actually prefers TSV; you can do CSV as a file, but if you want to support clipboard transfer, it needs to be TSV (for simple copy/paste)

---

<div class="post-metadata">

**Author:** ![Jim\_McDermott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/ec9cab/32.png) [@Jim\_McDermott](https://forum.xojo.com/u/Jim_McDermott)\
**Post date:** [October 31, 2020, 3:59pm UTC](https://forum.xojo.com/t/simple-recordset-export-routine/58350/4 "2020-10-31T15:59:04Z")

</div>

Thanks  
Will try the suggestions

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:47pm UTC](https://forum.xojo.com/t/simple-recordset-export-routine/58350/5 "2021-04-29T16:47:26Z")

</div>


