电商 微信 批量添加客户3 python版

原文:
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
')
    file1.write('VERSION:3.0
')
    # 备注
    remark = sheet.cell(i, 2).value
    file1.write('item0.X-ABLabel:'+str(remark)+'
')
    file1.write('item0.NOTE:'+str(remark)+'
')    
    # 姓名
    name = sheet.cell(i, 0).value
    file1.write('FN:'+str(name)+'
')
    file1.write('N:;'+str(name)+';;;
')
    # 电话
    phone = sheet.cell(i, 1).value    
    file1.write('TEL;CELL:'+str(int(phone))+'
')
    # GUID
    guid = str(uuid.uuid1()).upper()
    file1.write('UID:'+guid+'
')
    file1.write('END:VCARD
')

file1.close()
原文地址:https://www.cnblogs.com/guxingy/p/15010513.html