SlideShare ist ein Scribd-Unternehmen logo
Python- Excel- Bibliotheken PyExcelerator, XLRD, PyWin32
Inhalt Hintergrund PyExcelerator, XLRD, PyWin32 Vor- und Nachteile
Anreiz und Wahl der Bibliothek  Skripterweiterung für DataFinder:  Projekt- und Auftragsverwaltung Parsen von Excel-Tabellen zur Weiterverarbeitung Kriterien für die Wahl der Bibliothek: Einarbeiten und Fehlersuche  Dokumentation und Beispiele Funktionalitäten Plattformabhängigkeit /-unabhängigkeit
PyExcelerator Excel-Dokumente (97+), OpenOffice Calc  Python 2.4+ Unterstützung von Unicode in Excel Plattformunabhängig
XLRD Excel- Reader : Daten (auch bool‘sche Ausdrücke), Referenzen, Formatinformationen Keine Objekte, Formeln, Kommentare, Hyperlinks, etc. Plattformunabhängig Windows: Umgehen von COM-Objekten
PyWin32 Python unter Windows: COM-Interface Entwickelt von Mark Hammond Plattformabhängig Interaktion mit Windows-Programmen (Excel)
Auslesen einer Zeile in einem Excel-Worksheet parse_xls(filename)  get() keys() from pyExcelerator import * test = parse_xls("C:est.xls") liste = [] tupel = test[] dict  = tupel[1] cellcontent = dict.get((1,4)) for y in range(0, len(dict.keys())) helpvar = dict.get((0,y)) if helpvar != None: liste.append(helpvar) else: pass print(liste)
parse_xls(filename)
Vor- und Nachteile  PyExcelerator ↑ Gute Dokumentation und Beispiele, übersichtliche Anzahl an Funktionen ↑ Standard-Python-Datentypen (Listen und Dictionaries) ↑ Plattformunabhängig ↓ Letztes Release: April 2009 ↓ Kann zu Problemen mit Excel 2007/2010 führen
XLRD xlrd.open_workbook() sheet_by_index() / sheet_by_name() row(),  col(),  cell() import xlrd test = xlrd.open_workbook("C:est1.xls") liste = [] worksheet  = test.sheet_by_index(0) worksheet2 = test.sheet_by_name("Tabelle1") row = worksheet.row(0) col = worksheet2.col(0) cellcontent = worksheet.cell(0,0)
Vor- und Nachteile XLRD ↑ Gute Dokumentation, übersichtliche Anzahl an Funktionen ↑ nur zum Lesen von Excel-Dokumenten (Schreiben: XLWT) ↑ Plattformunabhängig ↓ Schreiben in Excel nicht möglich ↓ keine einfachen Datentypen
PyWin32 Dispatch() Open() Sheets() Cells() Close() from win32com.client Dispatch xls = Dispatch("Excel.Application") xls.Visible = 1 wb = xls.Workbooks.Open("C:est.xls") sht = wb.Sheets("Tabelle1") for x in range (1,6): row = sht.Cells(1,x) print(row) xls.Workbooks.Close()
Vor- und Nachteile PyWin32 ↑ Viele nützliche Funktionen zur Ausgabe von Zellen,Spalten, etc. ↑ Benutzt Excel-Bezeichnungen ↨ Sehr umfangreich ↓ Plattformabhängig: nur unter Windows ↓ COM-Objekte ↓ Einarbeiten schwierig
Fazit PyWin32, XLRD oder PyExcelerator? Kontext der Verwendung Andere Bibliotheken: pyXLReader, pyXLWriter, PythonOffice,…

Weitere ähnliche Inhalte

Empfohlen

2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
 
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design ProcessStorytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
 
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 

Empfohlen (20)

2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing
 
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design ProcessStorytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
 
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
 
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 

Python - Excel - Bibliotheken

  • 1. Python- Excel- Bibliotheken PyExcelerator, XLRD, PyWin32
  • 2. Inhalt Hintergrund PyExcelerator, XLRD, PyWin32 Vor- und Nachteile
  • 3. Anreiz und Wahl der Bibliothek Skripterweiterung für DataFinder: Projekt- und Auftragsverwaltung Parsen von Excel-Tabellen zur Weiterverarbeitung Kriterien für die Wahl der Bibliothek: Einarbeiten und Fehlersuche Dokumentation und Beispiele Funktionalitäten Plattformabhängigkeit /-unabhängigkeit
  • 4. PyExcelerator Excel-Dokumente (97+), OpenOffice Calc Python 2.4+ Unterstützung von Unicode in Excel Plattformunabhängig
  • 5. XLRD Excel- Reader : Daten (auch bool‘sche Ausdrücke), Referenzen, Formatinformationen Keine Objekte, Formeln, Kommentare, Hyperlinks, etc. Plattformunabhängig Windows: Umgehen von COM-Objekten
  • 6. PyWin32 Python unter Windows: COM-Interface Entwickelt von Mark Hammond Plattformabhängig Interaktion mit Windows-Programmen (Excel)
  • 7. Auslesen einer Zeile in einem Excel-Worksheet parse_xls(filename) get() keys() from pyExcelerator import * test = parse_xls("C:est.xls") liste = [] tupel = test[] dict = tupel[1] cellcontent = dict.get((1,4)) for y in range(0, len(dict.keys())) helpvar = dict.get((0,y)) if helpvar != None: liste.append(helpvar) else: pass print(liste)
  • 9. Vor- und Nachteile PyExcelerator ↑ Gute Dokumentation und Beispiele, übersichtliche Anzahl an Funktionen ↑ Standard-Python-Datentypen (Listen und Dictionaries) ↑ Plattformunabhängig ↓ Letztes Release: April 2009 ↓ Kann zu Problemen mit Excel 2007/2010 führen
  • 10. XLRD xlrd.open_workbook() sheet_by_index() / sheet_by_name() row(), col(), cell() import xlrd test = xlrd.open_workbook("C:est1.xls") liste = [] worksheet = test.sheet_by_index(0) worksheet2 = test.sheet_by_name("Tabelle1") row = worksheet.row(0) col = worksheet2.col(0) cellcontent = worksheet.cell(0,0)
  • 11. Vor- und Nachteile XLRD ↑ Gute Dokumentation, übersichtliche Anzahl an Funktionen ↑ nur zum Lesen von Excel-Dokumenten (Schreiben: XLWT) ↑ Plattformunabhängig ↓ Schreiben in Excel nicht möglich ↓ keine einfachen Datentypen
  • 12. PyWin32 Dispatch() Open() Sheets() Cells() Close() from win32com.client Dispatch xls = Dispatch("Excel.Application") xls.Visible = 1 wb = xls.Workbooks.Open("C:est.xls") sht = wb.Sheets("Tabelle1") for x in range (1,6): row = sht.Cells(1,x) print(row) xls.Workbooks.Close()
  • 13. Vor- und Nachteile PyWin32 ↑ Viele nützliche Funktionen zur Ausgabe von Zellen,Spalten, etc. ↑ Benutzt Excel-Bezeichnungen ↨ Sehr umfangreich ↓ Plattformabhängig: nur unter Windows ↓ COM-Objekte ↓ Einarbeiten schwierig
  • 14. Fazit PyWin32, XLRD oder PyExcelerator? Kontext der Verwendung Andere Bibliotheken: pyXLReader, pyXLWriter, PythonOffice,…