-2

How to get data from one Excel sheet and write on another Excel Sheet using Python?

Eg: I have Excel name Original Sheet with come contents i need to read those contents and write on another Excel name Copy Sheet By Using Python.

Note : Read and Write both should be done by using Python Code

Matt Ellen
  • 11,268
  • 4
  • 68
  • 90
  • 1
    Possible duplicate of [Reading/parsing Excel (xls) files with Python](https://stackoverflow.com/questions/2942889/reading-parsing-excel-xls-files-with-python) –  Jan 04 '18 at 09:59
  • Is it possible to read the data from specific Column of the Excel and Write to another Excel sheet using Python..in that only they mentioned about read/parse Excel with python only... –  Jan 04 '18 at 11:13

1 Answers1

1

You can use the pandas library to do this

import pandas as pd
df = pd.read_excel('original_sheet.xlsx')
df.to_excel('copy_sheet.xlsx')
Marine
  • 408
  • 4
  • 10
  • Thanks.! If i need to need to read only the specify column from original sheet and write that to copy sheet..is it possible..if so? how? –  Jan 04 '18 at 10:19
  • For this you can use the parameter `usecols` from `pandas.read_excel`. I suggest you have a look at `https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_excel.html` – Marine Jan 04 '18 at 14:47
  • Link is Not working...It shows 404 Error.! **@Marine** –  Jan 05 '18 at 03:51
  • Weird it works for me ... just google `pandas read_excel`, you'll find the documentation – Marine Jan 08 '18 at 07:51