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

查看:175
本文介绍了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或更高版本)上完成。 / p>

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

推荐答案

您可以安装 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天全站免登陆