You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 11, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/user/quickstart.rst
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Read the PDF
16
16
17
17
Reading a PDF to extract tables with pypdf_table_extraction is very simple.
18
18
19
-
Begin by importing the Camelot module
19
+
Begin by importing the pypdf_table_extraction module
20
20
21
21
.. code-block:: pycon
22
22
@@ -34,7 +34,7 @@ Now, let's try to read a PDF. (You can check out the PDF used in this example `h
34
34
>>> tables
35
35
<TableList n=1>
36
36
37
-
Now, we have a :class:`TableList <camelot.core.TableList>` object called ``tables``, which is a list of :class:`Table <camelot.core.Table>` objects. We can get everything we need from this object.
37
+
Now, we have a :class:`TableList <pypdf_table_extraction.core.TableList>` object called ``tables``, which is a list of :class:`Table <pypdf_table_extraction.core.Table>` objects. We can get everything we need from this object.
38
38
39
39
We can access each table using its index. From the code snippet above, we can see that the ``tables`` object has only one table, since ``n=1``. Let's access the table using the index ``0`` and take a look at its ``shape``.
40
40
@@ -55,7 +55,7 @@ Let's print the parsing report.
55
55
'page': 1
56
56
}
57
57
58
-
Woah! The accuracy is top-notch and there is less whitespace, which means the table was most likely extracted correctly. You can access the table as a pandas DataFrame by using the :class:`table <camelot.core.Table>` object's ``df`` property.
58
+
Woah! The accuracy is top-notch and there is less whitespace, which means the table was most likely extracted correctly. You can access the table as a pandas DataFrame by using the :class:`table <pypdf_table_extraction.core.Table>` object's ``df`` property.
59
59
60
60
.. code-block:: pycon
61
61
@@ -64,15 +64,15 @@ Woah! The accuracy is top-notch and there is less whitespace, which means the ta
64
64
.. csv-table::
65
65
:file: ../_static/csv/foo.csv
66
66
67
-
Looks good! You can now export the table as a CSV file using its :meth:`to_csv() <camelot.core.Table.to_csv>` method. Alternatively you can use :meth:`to_json() <camelot.core.Table.to_json>`, :meth:`to_excel() <camelot.core.Table.to_excel>` :meth:`to_html() <camelot.core.Table.to_html>` :meth:`to_markdown() <camelot.core.Table.to_markdown>` or :meth:`to_sqlite() <camelot.core.Table.to_sqlite>` methods to export the table as JSON, Excel, HTML files or a sqlite database respectively.
67
+
Looks good! You can now export the table as a CSV file using its :meth:`to_csv() <pypdf_table_extraction.core.Table.to_csv>` method. Alternatively you can use :meth:`to_json() <pypdf_table_extraction.core.Table.to_json>`, :meth:`to_excel() <pypdf_table_extraction.core.Table.to_excel>` :meth:`to_html() <pypdf_table_extraction.core.Table.to_html>` :meth:`to_markdown() <pypdf_table_extraction.core.Table.to_markdown>` or :meth:`to_sqlite() <pypdf_table_extraction.core.Table.to_sqlite>` methods to export the table as JSON, Excel, HTML files or a sqlite database respectively.
68
68
69
69
.. code-block:: pycon
70
70
71
71
>>> tables[0].to_csv('foo.csv')
72
72
73
73
This will export the table as a CSV file at the path specified. In this case, it is ``foo.csv`` in the current directory.
74
74
75
-
You can also export all tables at once, using the :class:`tables <camelot.core.TableList>` object's :meth:`export() <camelot.core.TableList.export>` method.
75
+
You can also export all tables at once, using the :class:`tables <pypdf_table_extraction.core.TableList>` object's :meth:`export() <pypdf_table_extraction.core.TableList.export>` method.
76
76
77
77
.. code-block:: pycon
78
78
@@ -87,7 +87,7 @@ You can also export all tables at once, using the :class:`tables <camelot.core.T
87
87
88
88
This will export all tables as CSV files at the path specified. Alternatively, you can use ``f='json'``, ``f='excel'``, ``f='html'``, ``f='markdown'`` or ``f='sqlite'``.
89
89
90
-
.. note:: The :meth:`export() <camelot.core.TableList.export>` method exports files with a ``page-*-table-*`` suffix. In the example above, the single table in the list will be exported to ``foo-page-1-table-1.csv``. If the list contains multiple tables, multiple CSV files will be created. To avoid filling up your path with multiple files, you can use ``compress=True``, which will create a single ZIP file at your path with all the CSV files.
90
+
.. note:: The :meth:`export() <pypdf_table_extraction.core.TableList.export>` method exports files with a ``page-*-table-*`` suffix. In the example above, the single table in the list will be exported to ``foo-page-1-table-1.csv``. If the list contains multiple tables, multiple CSV files will be created. To avoid filling up your path with multiple files, you can use ``compress=True``, which will create a single ZIP file at your path with all the CSV files.
91
91
92
92
.. note:: pypdf_table_extraction handles rotated PDF pages automatically. As an exercise, try to extract the table out of `this PDF`_.
93
93
@@ -98,7 +98,7 @@ Specify page numbers
98
98
99
99
By default, pypdf_table_extraction only uses the first page of the PDF to extract tables. To specify multiple pages, you can use the ``pages`` keyword argument::
@@ -150,7 +150,7 @@ To extract tables from encrypted PDF files you must provide a password when call
150
150
151
151
pypdf_table_extraction supports PDFs with all encryption types supported by `pypdf`_. This might require installing PyCryptodome. An exception is thrown if the PDF cannot be read. This may be due to no password being provided, an incorrect password, or an unsupported encryption algorithm.
152
152
153
-
Further encryption support may be added in future, however in the meantime if your PDF files are using unsupported encryption algorithms you are advised to remove encryption before calling :meth:`read_pdf() <camelot.read_pdf>`. This can been successfully achieved with third-party tools such as `QPDF`_.
153
+
Further encryption support may be added in future, however in the meantime if your PDF files are using unsupported encryption algorithms you are advised to remove encryption before calling :meth:`read_pdf() <pypdf_table_extraction.read_pdf>`. This can been successfully achieved with third-party tools such as `QPDF`_.
0 commit comments