PostgreSQL 查询到 Excel 表 [英] PostgreSQL Query to Excel Sheet

查看:26
本文介绍了PostgreSQL 查询到 Excel 表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将一些数据从 PostgreSQL 导出到 Excel(客户希望快速),上次 Excel 在打开或导入我的 COPYd csv 文件(行结尾、utf-8 编码等)时遇到严重问题,我花了最多一个小时.

I need to export some data from PostgreSQL to Excel (quick customer wish), and the last time Excel had serious problems opening or importing my COPYd csv files (line endings, utf-8 encoding, etc), and it took me an hour at best.

有人知道生成真正 Excel 文件的快速、优雅的解决方案吗?像一个小shell脚本之类的?

Does someone know a quick, elegant solution that generates a real Excel file? Like a small shell script or the like?

我希望在我的 Linux 机器(Debian 5.0 Lenny)或 Windows(XP 或更高版本)上完成.

I want this to be done either on my Linux box (Debian 5.0 Lenny) or on Windows (XP or higher).

推荐答案

你可以安装 Windows 机器上的 PostgreSQL ODBC 驱动程序,然后将 Excel 连接到数据库 就像这篇博文中解释的那样(除了使用 ODBC 而不是 OLEDB).

You could install the PostgreSQL ODBC driver on the Windows machine, and then connect Excel to the database like explained in this blog post (except using ODBC rather than OLEDB).

我没有测试过这个.我不确定这是否比导出 CSV 和修复它更容易(考虑到 Excel 的情况).

I haven't tested this. I'm not really sure if this makes it any easier than exporting CSV and fixing it (given what Excel is like).

编辑(感谢@Tometzky):最佳解决方案是使用 PostgreSQL ODBC 驱动程序将 Microsoft Access 连接到数据库并从 Access 导出到 Excel.

EDIT (thanks @Tometzky): The best solution is to use the PostgreSQL ODBC driver to connect Microsoft Access to the database and from Access export to Excel.

这篇关于PostgreSQL 查询到 Excel 表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆