martsberger / tablepyxl Goto Github PK
View Code? Open in Web Editor NEWA bridge between html tables and openpyxl
A bridge between html tables and openpyxl
I was trying to save multiple tables in the same csv (Same Sheet). For this, I simply concatenated the second table in the string of the first table, however, the library only writes the first table, leaving out the second one. Is there any other way to do so?
when trying to write multiple tables in html to one wb it gives me this error. ur manual isnt very clear, u should refine it. how to write many tables to one wb, in same sheet or not, doesnt really matter. also, what about if tables don't have a name or id ? what should b the requirements for this ?
I am wondering if there is a plan to support XL -> HTML..
Thanks
at least in case the whole cell contains one big hyperlink.
expected result: hyperlink is preserverved when converting to workbook from html
actual result: hyperlink is stripped out
I tried to output a HTML table to excel and it gave me this error. My openpyxl version is 2.6.2.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
table {
border-collapse: collapse;
}
table, th, td {
border: 1px solid black;
}
th, td {
padding: 8px;
text-align: left;
}
</style>
</head>
<body>
<table>
<tr>
<th rowspan="2">Name</th>
<th rowspan="2">Measure</th>
<th colspan="3">Plan</th>
<th colspan="3">Fact</th>
<th rowspan="2">%</th>
</tr>
<tr>
<th>Volume</th>
<th>Price</th>
<th>Total price</th>
<th>Volume</th>
<th>Price</th>
<th>Total price</th>
</tr>
<tr>
<th colspan="9">Section</th>
</tr>
<tr>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
</tr>
<tr>
<th colspan="9">Subsection</th>
</tr>
<tr>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
<td>value</td>
</tr>
</table>
</body>
</html>
Traceback (most recent call last):
File "/home/aesfur/workspace/osla-api/src/apps/building/__init__.py", line 27, in <module>
tablepyxl.document_to_xl(table, 'data.xlsx')
File "/home/aesfur/workspace/venv/osla/lib/python3.6/site-packages/tablepyxl/tablepyxl.py", line 96, in document_to_xl
wb = document_to_workbook(doc, base_url=base_url)
File "/home/aesfur/workspace/venv/osla/lib/python3.6/site-packages/tablepyxl/tablepyxl.py", line 86, in document_to_workbook
table_to_sheet(table, wb)
File "/home/aesfur/workspace/venv/osla/lib/python3.6/site-packages/tablepyxl/tablepyxl.py", line 68, in table_to_sheet
insert_table(table, ws, 1, 1)
File "/home/aesfur/workspace/venv/osla/lib/python3.6/site-packages/tablepyxl/tablepyxl.py", line 104, in insert_table
row = write_rows(worksheet, table.body, row, column)
File "/home/aesfur/workspace/venv/osla/lib/python3.6/site-packages/tablepyxl/tablepyxl.py", line 41, in write_rows
cell.value = table_cell.value
AttributeError: 'MergedCell' object attribute 'value' is read-only
Process finished with exit code 1
openpyxl 3.0.3
/site-packages/tablepyxl/style.py:188: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
self.head = TableHead(table.find('thead'), parent=self) if table.find('thead') else None
/site-packages/tablepyxl/style.py:189: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
self.body = TableBody(table.find('tbody') or table, parent=self)
Since 2.6 version Cell type constants not a part of class anymore.
https://bitbucket.org/openpyxl/openpyxl/commits/b733e47647b3301dd912c1ecd85f2b9e5aef4252
This break TableCell.data_type()
when try to getattr(Cell, cell_type)
Now we need call getattr
on openpyxl.cell.cell
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.