hardik27 commited on
Commit
27a08f1
·
verified ·
1 Parent(s): a1d7807

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -24
app.py CHANGED
@@ -33,29 +33,11 @@ def convert_pdf_to_excel(pdf_file):
33
 
34
  whole_data = pd.DataFrame(whole_data)
35
  whole_data.columns = ["Part No.","Part Color Code","Part Name"]
36
- # whole_data.to_csv("Extracted_Data.csv",index=False)
37
-
38
- # Convert each table into a DataFrame
39
- # dfs = []
40
- # for table in tables:
41
- # dfs.append(table)
42
-
43
- # # Concatenate all DataFrames into a single DataFrame
44
- # result = pd.concat(dfs)
45
-
46
- # Convert DataFrame to Excel
47
- # excel_file = pdf_file.name.replace('.pdf', '.xlsx')
48
- # result.to_excel(excel_file, index=False)
49
  excel_file = pdf_file.name.replace('.pdf', '.xlsx')
50
  whole_data.to_excel(excel_file, index=False)
51
 
52
  return excel_file
53
 
54
-
55
- # whole_data.to_csv(excel_file,index=False)
56
-
57
- # return excel_file
58
-
59
  def main():
60
  st.title("PDF to Excel Converter")
61
 
@@ -84,9 +66,4 @@ def main():
84
  st.error("Error: Converted Excel file not found")
85
 
86
  if __name__ == "__main__":
87
- main()
88
-
89
- # file_name = input("Give Complete file location")
90
-
91
- # file_name = '/home/hardik/Downloads/data extraction/HSCI.2.20231121154327.WG.IFORD001.0492.4348.5M09-01.pdf'
92
- # pdf_in_file = open(file_name,'rb')
 
33
 
34
  whole_data = pd.DataFrame(whole_data)
35
  whole_data.columns = ["Part No.","Part Color Code","Part Name"]
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  excel_file = pdf_file.name.replace('.pdf', '.xlsx')
37
  whole_data.to_excel(excel_file, index=False)
38
 
39
  return excel_file
40
 
 
 
 
 
 
41
  def main():
42
  st.title("PDF to Excel Converter")
43
 
 
66
  st.error("Error: Converted Excel file not found")
67
 
68
  if __name__ == "__main__":
69
+ main()