1. 2. 3. path="/files" 5. 6. 10. 11. import os 7. 8. from openpyxl import load_workbook 12. 13. 15. 16. 17. 18. 19. 20- 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. file_list = os.listdir (path) print (file_list) results = [] for file_name_raw in file_list: file_name = "./files/" + file_name_raw wb = load_workbook (filename-file_name, data_only=True) wswb.active result = [] -> result.append(file_name_raw) result.append(ws['C2¹].value) result.append(ws['*(3*].value) result.append(ws['E2"].value) result.append(ws['E3'].value) results.append(result) print (results) from openpyxl import Workbook wb = Workbook () ws - wb.active for i in results: ws.append(1) wb.save("results.xlsx") Raw Copy Extern Enlighter's

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This code extracts three Excel files by specifying the data values ​​in C2, C3, E2, and E4, respectively, and organizes them in one place. I want to know how to fix it??

1.
HN
2.
3.
import os
path="/files"
file_list = os.listdir(path)
5. print (file_list)
6.
7.
17.
18.
19-
20.
21.
22.
23.
24.
25.
26.
27.
28.
from openpyxt import load_workbook
9.
10.
11.
12. for file_name_raw in file_list:
13.
14.
15.
16.
results = []
file_name = "./files/" + file_name_raw
wb = load_workbook (filename-file_name, data_only=True)
ws wb.active
result = []
result.append(file_name_raw)
result.append(ws['C2¹].value)
result.append(ws['C3¹].value)
result.append(ws['E2" ].value)
result.append(ws['E3'].value)
results.append(result)
print (results)
29.
30. from openpyxl import Workbook
31.
wb = Workbook ()
32.
ws - wb.active
33.
34. for i in results:
35.
ws.append(i)
36.
37.
wb.save("results.xlsx")
Raw Copy Extern
Enlighter's
Transcribed Image Text:1. HN 2. 3. import os path="/files" file_list = os.listdir(path) 5. print (file_list) 6. 7. 17. 18. 19- 20. 21. 22. 23. 24. 25. 26. 27. 28. from openpyxt import load_workbook 9. 10. 11. 12. for file_name_raw in file_list: 13. 14. 15. 16. results = [] file_name = "./files/" + file_name_raw wb = load_workbook (filename-file_name, data_only=True) ws wb.active result = [] result.append(file_name_raw) result.append(ws['C2¹].value) result.append(ws['C3¹].value) result.append(ws['E2" ].value) result.append(ws['E3'].value) results.append(result) print (results) 29. 30. from openpyxl import Workbook 31. wb = Workbook () 32. ws - wb.active 33. 34. for i in results: 35. ws.append(i) 36. 37. wb.save("results.xlsx") Raw Copy Extern Enlighter's
Expert Solution
steps

Step by step

Solved in 5 steps with 6 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education