Python reads Excel data into another Excel

Source: Internet
Author: User

#-*-coding:utf-8-*-ImportxlrdImportXLWTdefexcel_copy (Dir_from, Dir_to, sheet_name):" "write from one Excel to another Excel" "WB=Xlrd.open_workbook (Dir_from)#Select Sheet PageSheet1 =wb.sheet_by_index (0)#Print the number of rows per sheet page    #print ("Sheet1 of rows:%d"% sheet1.nrows)    #Create write FileWorkbook = xlwt. Workbook (encoding="ASCII")    #Create write sheet pageWorksheet =Workbook.add_sheet (sheet_name)#writing to Excel     forIinchRange (0, sheet1.nrows): Values_row1=sheet1.row_values (i)Print(VALUES_ROW1) forSinchRange (len (values_row1)): Worksheet.write (i, S, Values_row1[s]) workbook.save (dir_to)

Python reads Excel data into another Excel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.