<jupyter_start><jupyter_text>Excel file Excel Read File<jupyter_code>import openpyxl
wb= openpyxl.load_workbook('BSE183009.xlsx')
wb.sheetnames
sh= wb['Sheet1']
cl = sh['A1']
print(cl.value)
for i in range(1,12):
    print(sh.cell(i,1).value)<jupyter_output>name 
rafay
haseeb
None
None
None
None
None
None
None
None<jupyter_text>Excel write file<jupyter_code>import openpyxl
import os
my_wb = openpyxl.Workbook()
print(my_wb.sheetnames)
my_sh = my_wb['Sheet']
my_sh['A1'].value =999
my_sh.title= 'MySheet1'
my_sh2= my_wb.create_sheet(index=0,title ='Sheet2')
my_wb.save('BSE183009-2.xlsx')<jupyter_output><empty_output><jupyter_text>Word File<jupyter_code>import docx
import os
my_doc = docx.Document('Artificial Intelligence.docx')
m = len(my_doc.paragraphs[34].runs)         # Number of runs within a specific document.
print(m)
def getAllParagraphs(filename):
    a_doc = docx.Document(filename)
    fullText = []
    for a_para in a_doc.paragraphs:
        fullText.append(a_para.text)
    return '\n'.join(fullText)


print(getAllParagraphs('Artificial Intelligence.docx'))<jupyter_output>Artificial intelligenceFrom Wikipedia, the free encyclopedia

In computer science, artificial intelligence (AI), sometimes called machine intelligence, is intelligence demonstrated by machines, in contrast to the natural intelligence displayed by humans. Colloquially, the term "artificial intelligence" is often used to describe machines (or computers) that mimic "cognitive" functions that humans associate with the human mind, such as "learning" and "problem solving".[1]

As machines become increasingly capable, tasks considered to require "intelligence" are often removed from the definition of AI, a phenomenon known as the AI effect.[2] A quip in Tesler's Theorem says "AI is whatever hasn't been done yet."[3] For instance, optical character recognition is frequently excluded from things considered to be AI, having become a routine technology.[4] Modern machine capabilities generally classified as AI include successfully understanding human speech,[5] competing at the highest level in s[...]<jupyter_text>creating a new file<jupyter_code>my_doc= docx.Document()
data = input('Enter some dat to store into a file: ')

my_doc.add_paragraph(data)
my_doc.save('Rafay.docx')
def getAllParagraphs(filename):
    a_doc = docx.Document(filename)
    fullText = []
    for a_para in a_doc.paragraphs:
        fullText.append(a_para.text)
    return '\n'.join(fullText)
print(getAllParagraphs('Rafay.docx'))<jupyter_output>hello!! World how are you
fuck you ass-hole, I love this world
{'fraction_non_alphanumeric': 0.09558823529411764, 'fraction_numerical': 0.013157894736842105, 'mean_word_length': 5.838624338624339, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '308238', 'license': 'MIT', 'n_tokens_mistral': 841, 'n_tokens_neox': 815, 'n_words': 252, 'path': 'Rafay notes/Samsung Course/Home Notes and Pratice/Read and Write different type of files/Word, PDF and excel File work.ipynb', 'repo_name': 'rafay99-epic/Ssmsunng-Innovation-Campus-Notes', 'size': '2584'}