How to Output csv,tsv From RecordSet

I tried to output a tsv file from an Access table, but surprisingly there was no easy way.

I will keep it for memoirs.

Code to Output csv,tsv From RecordSet

The outline of the process is as follows.

①Get header from RecordSet with delimiter
②Fetch data from RecordSet with delimiter
③Output header and data to file

I created an access file.

You can download from here.

Csv, tsv Output Result From RecordSet

Here is the result.

Table Contents

Csv and tsv is from table below.

supplier_cd zipcode tel supplier_name fax
301101 100-0005 000-001 Cargill 03-****-****
301102 651-0087 000-002 Nestle 4-****-****
301103 60601 000-003 Archer Daniels Midland 5-****-****
301104 153-8578 000-004 Unilever 6-****-****
301105 150-0002 000-005 Coca-Cola 7-****-****
301106 15222 000-006 Kraft Heinz 8-****-****
301107 104-0031 000-007 Suntory 9-****-****
301108 200000 000-008 Lactalis 10-****-****

Output Result

It was output well like this.




I will introduce the method to get the data of the table to RecordSet in another page.

C# Store csv in DataTableSometimes I wanted to import data from a CSV file and put it in the ...


メールアドレスが公開されることはありません。 * が付いている欄は必須項目です