Every line of 'convert pdf to excel using python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
16 def copy_excel(excelpath1, excelpath2): 17 """复制excel,把 excelpath1 数据复制到 excelpath2""" 18 wb2 = openpyxl.Workbook() 19 wb2.save(excelpath2) 20 # 读取数据 21 wb1 = openpyxl.load_workbook(excelpath1) 22 wb2 = openpyxl.load_workbook(excelpath2) 23 sheets1 = wb1.sheetnames 24 sheets2 = wb2.sheetnames 25 sheet1 = wb1[sheets1[0]] 26 sheet2 = wb2[sheets2[0]] 27 max_row = sheet1.max_row # 最大行数 28 max_column = sheet1.max_column # 最大列数 29 for m in list(range(1, max_row + 1)): 30 for n in list(range(97, 97 + max_column)): # chr(97)='a' 31 n = chr(n) # ASCII字符 32 i = '%s%d' % (n, m) # 单元格编号 33 cell1 = sheet1[i].value # 获取data单元格数据 34 sheet2[i].value = cell1 # 赋值到test单元格 35 wb2.save(excelpath2) # 保存数据 36 wb1.close() # 关闭excel 37 wb2.close()
68 def worksheet_from_excel(excel_sheet): 69 worksheet = Worksheet() 70 for col in range(excel_sheet.ncols): 71 for row in range(excel_sheet.nrows): 72 cell = excel_sheet.cell(row, col) 73 if cell.ctype == XL_CELL_ERROR: 74 formula = '=%s' % (error_text_from_code[cell.value], ) 75 elif cell.ctype == XL_CELL_DATE: 76 formula = '=DateTime(%s, %s, %s, %s, %s, %s)' % xldate_as_tuple( 77 cell.value, excel_sheet.book.datemode) 78 else: 79 formula = unicode(excel_sheet.cell(row, col).value) 80 worksheet[col + 1, row + 1].formula = formula 81 return worksheet
488 def excel(self): 489 """Query data base and build nsf and doe excels.""" 490 rc = self.rc 491 if not rc.people: 492 sys.exit("please rerun specifying --people PERSON") 493 if isinstance(rc.people, str): 494 rc.people = [rc.people] 495 since_date = get_since_date(rc) 496 target = rc.people[0] 497 query_results = self.query_ppl(target, since_date=since_date) 498 self.render_template1(**query_results) 499 self.render_template2(**query_results)
176 def test_issue_60_chinese_text_in_python_2_stdout(): 177 import sys 178 179 data = [["这", "是", "中", "文"], ["这", "是", "中", "文"]] 180 sheet = pe.Sheet(data) 181 sys.stdout.write(repr(sheet))
84 def WriteToExcel(): 85 f = open('wordbank.csv','w') 86 list = CountInstancesGlobal() 87 for twoplet in list: 88 f.write(str(twoplet[0])) 89 f.write(',') 90 f.write(str(twoplet[1])) 91 f.write('\n') 92 f.close()