guxingy

原文:
https://blog.csdn.net/qq_27017791/article/details/113849053

一、下载

在win7上打包的exe,打包后的exe还是有点大,先将就用吧

使用步骤

  1. 解压文件excel转换为vcf.rar
  2. 在exe同级目录中,新建一个Excel,名称为:111.xlsx
  3. 在Excel中增加数据,分别是:姓名、电话、备注
  4. 执行Excel,然后就会生成一个vcf文件了

win7上编译的,win10运行好像是有问题的,下次win10上编译过
https://files-cdn.cnblogs.com/files/guxingy/excel转换为vcf.rar

二、Excel

三、生成后的数据

四、使用

把这个文件123.vcf,发到iphone手机上,用通讯录打开就是了

五、代码

import xlrd
import uuid
 
# 111.xlsx为需要处理的表格(姓名+电话)
file2 = \'111.xlsx\'
 
# 123.vcf 为处理后生成的文件
file1=open(\'123.vcf\', \'w+\', encoding=\'utf-8\')
 
workbook = xlrd.open_workbook(file2)
sheet = workbook.sheet_by_index(0)
rows = sheet.nrows


for i in range(rows):
    file1.write(\'BEGIN:VCARD\n\')
    file1.write(\'VERSION:3.0\n\')
    # 备注
    remark = sheet.cell(i, 2).value
    file1.write(\'item0.X-ABLabel:\'+str(remark)+\'\n\')
    file1.write(\'item0.NOTE:\'+str(remark)+\'\n\')    
    # 姓名
    name = sheet.cell(i, 0).value
    file1.write(\'FN:\'+str(name)+\'\n\')
    file1.write(\'N:;\'+str(name)+\';;;\n\')
    # 电话
    phone = sheet.cell(i, 1).value    
    file1.write(\'TEL;CELL:\'+str(int(phone))+\'\n\')
    # GUID
    guid = str(uuid.uuid1()).upper()
    file1.write(\'UID:\'+guid+\'\n\')
    file1.write(\'END:VCARD\n\')

file1.close()

分类:

技术点:

相关文章:

  • 2021-08-05
  • 2022-12-23
  • 2021-12-31
  • 2021-04-14
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-27
  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2021-11-27
  • 2021-10-16
相关资源
相似解决方案