Created
May 26, 2019 23:00
-
-
Save juanobrach/8910829a16874197c6e1ddb9347e3e46 to your computer and use it in GitHub Desktop.
Export to CSV access database with PowerShell command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$MsAccess = New-Object -ComObject Access.Application | |
$MsAccess.OpenCurrentDatabase('Database1.accdb') | |
$MsAccess.Run('export_query') | |
$MsAccess.CloseCurrentDatabase() | |
$MsAccess.Quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run Power Shell script on comand line "./access-export-to-csv-power-shell.ps1" | |
Requirements | |
Database1 file or rename database name on script | |
Export query created as module on the DB | |
Public Sub export_query() | |
DoCmd.TransferText transferType:=acExportDelim, TableName:="Table1", FileName:="D:\Exported.csv", HasFieldNames:=True | |
DoCmd.Quit | |
End Sub | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment