header image

Export Access data to csv file

Posted by: | November 27, 2009 | 3 Comments |

We already have all the functionality we need to achieve this.

Import-Module accessfunctions
$db = Open-AccessDatabase -name test03.mdb -path c:\test
Get-AccessData -sql "select * from test1" -connection $db | Export-Csv -Path c:\test\test1.csv –NoTypeInformation

Open the csv file in Excel and the data is available.  If you open the csv file in notepad be aware that the fields are padded and you need to scroll to the right to see all the data.


We could add the export functionality into our Get-AccessData function but if we stick with the PowerShell composability concepts we want to keep the functions small and focussed.  If you want to change the function – feel free – just add a switch for csv output and a parameter for the csv path. Then use another if statement to control writing to the csv.


under: Office 2010, PowerShell original, PowerShellV2


  1. By: Paul Veditz on June 28, 2011 at 7:25 pm      

    Trying to access a old Access 97 database.

  2. By: Frank on February 20, 2014 at 7:48 am      

    Hi, Where can I find this module ?

  3. By: RichardSiddaway on February 21, 2014 at 11:46 am      

    The module is one of mine that I wrote fro experimenting using Access