You can export the Netezza table in many ways. You can export the data to CSV format using either Netezza external table or Netezza nzsql commands with – o option. Netezza does not support exporting data to excel (xls/xlsx) format. You have to perform some work around to get data out to excel format. In this article, we will check Netezza Export Table Data into Excel Format.
Netezza Export Table Data into Excel Format
Netezza export table data into excel format involves two steps:
- Export Netezza table data to CSV format using Netezza external table or Netezza nzsql command with – o option.
Netezza external table is fasted way to export Netezza table data compared to a Netezza nzsql command. Netezza nzsql with option -o is easy method compared to creating Netezza external tables.
- Use third-party tool to convert the CSV or flat file to excel format. You can make use of open source third party packages or tools to convert flat file to excel format.
You can even automate the entire Netezza export table data into excel format process using python or shell script.
Export Netezza Table Data to CSV format
You can read my other post on Netezza export table data to CSV format to understand how to export Netezza table data out to CSV format.
Convert CSV or Flat File to Excel (xls/xlsx) Format
For the demonstration purpose we will make use openpyxlsx python package to convert CSV/flat file created in the above step.
Convert CSV to Excel Format using openpyxlsx package
To convert flat file, we will use the third-party python package openpyxl. Below is the example that demonstrate usage of openpyxlsx package:
https://gist.github.com/8f05337caaae3628618b0ed587ad652f
You can automate the entire process by combining CSV generation and excel conversion tool.
Read: