Ai
2 Star 0 Fork 2

刘煜/办公脚本

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vcard.py 871 Bytes
一键复制 编辑 原始数据 按行查看 历史
刘煜 提交于 2022-01-05 15:48 +08:00 . 跳过空行
import pandas as pd
import sys
output = '员工通讯录.vcf'
contacts = pd.read_excel('员工通讯录.xlsx', engine="openpyxl",sheet_name=0, skiprows=1)
with open(output, 'w', encoding = 'utf-8') as f:
#将每一行转为字典
for contact in contacts.to_dict("records"):
name = str(contact["姓名"])
# 跳过空行
if name == "nan":
continue
f.write("BEGIN:VCARD\n")
f.write("VERSION:3.0\n")
f.write("N:" + name[0] + ";" + name[1:] + ";;;\n")
f.write("FN:%s\n" % name)
f.write("ORG;CHARSET=UTF-8:华清远见\n")
f.write("TITLE:%s\n" % contact["职务"])
f.write("TEL;TYPE=WORK:%s\n" % contact["联系电话"])
f.write("EMAIL:%s\n" % contact["邮箱"])
#f.write("X-QQ:%.0f\n" % contact["QQ"])
f.write("END:VCARD\n")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tinytaro/office-script.git
git@gitee.com:tinytaro/office-script.git
tinytaro
office-script
办公脚本
master

搜索帮助