拆分< ul>进入a< table>和a< ul>
这是我们的一种产品的产品详细信息,并且在将其导入Shopify之前要在我们的电子杂志商店中显示:
<ul>
<li>Comfort: waterproof, windproof, lightweight, engineered ventilation</li>
<li>Material: 100% polyester with polyurethane coating</li>
<li>Water column pressure: 4000mm</li>
<li>Fit: Casual unisex</li>
<li>Snap closure</li>
<li>Placket with snap fastenings</li>
<li>Drawstring hood with cap brim</li>
<li>Snap adjustable cuffs</li>
<li>Back yoke with concealed vents</li>
<li>Two side pockets with snaps</li>
<li>Eyelets at arm holes</li>
<li>Ultrasonically welded seams</li>
<li>Fishtail hem</li>
</ul>
我想实现的是将其转换为:
<table>
<tr>
<td>Comfort:</td>
<td>waterproof, windproof, lightweight, engineered ventilation</td>
</tr>
<tr>
<td>Material:</td>
<td>100% polyester with polyurethane coating</td>
</tr>
<tr>
<td>Water column pressure:</td>
<td>4000mm</td>
</tr>
<tr>
<td>Fit:</td>
<td>Casual unisex</td>
</tr>
</table>
<ul>
<li>Snap closure</li>
<li>Placket with snap fastenings</li>
<li>Drawstring hood with cap brim</li>
<li>Snap adjustable cuffs</li>
<li>Back yoke with concealed vents</li>
<li>Two side pockets with snaps</li>
<li>Eyelets at arm holes</li>
<li>Ultrasonically welded seams</li>
<li>Fishtail hem</li>
</ul>
它背后的逻辑:所有带有结肠的线应处于表格格式。其余的应为列表格式。
当线带有结肠时,应将其分为表格中的两个不同的列。例如,&lt; li&gt;材料:带有聚氨酯涂层的100%聚酯蛋白&lt;/li&gt;
<tr>
<td>Material:</td>
<td>100% polyester with polyurethane coating</td>
</tr>
可以在Google表中自动完成,其中每个单元格都包含一个产品的产品详细信息。
谢谢!
This is what the product details for one of our products look like and is formatted before we import it into Shopify to be shown on our e-com store:
<ul>
<li>Comfort: waterproof, windproof, lightweight, engineered ventilation</li>
<li>Material: 100% polyester with polyurethane coating</li>
<li>Water column pressure: 4000mm</li>
<li>Fit: Casual unisex</li>
<li>Snap closure</li>
<li>Placket with snap fastenings</li>
<li>Drawstring hood with cap brim</li>
<li>Snap adjustable cuffs</li>
<li>Back yoke with concealed vents</li>
<li>Two side pockets with snaps</li>
<li>Eyelets at arm holes</li>
<li>Ultrasonically welded seams</li>
<li>Fishtail hem</li>
</ul>
What I would like to achieve is to convert that ^ into this:
<table>
<tr>
<td>Comfort:</td>
<td>waterproof, windproof, lightweight, engineered ventilation</td>
</tr>
<tr>
<td>Material:</td>
<td>100% polyester with polyurethane coating</td>
</tr>
<tr>
<td>Water column pressure:</td>
<td>4000mm</td>
</tr>
<tr>
<td>Fit:</td>
<td>Casual unisex</td>
</tr>
</table>
<ul>
<li>Snap closure</li>
<li>Placket with snap fastenings</li>
<li>Drawstring hood with cap brim</li>
<li>Snap adjustable cuffs</li>
<li>Back yoke with concealed vents</li>
<li>Two side pockets with snaps</li>
<li>Eyelets at arm holes</li>
<li>Ultrasonically welded seams</li>
<li>Fishtail hem</li>
</ul>
The logic behind it: All lines that has a colon should be in a table format. The rest should be in a list format.
When the line has a colon, it should be split into two different columns inside the table. For example, <li>Material: 100% polyester with polyurethane coating</li>
is turned into
<tr>
<td>Material:</td>
<td>100% polyester with polyurethane coating</td>
</tr>
Can this be automatically done in Google Sheets where each cell contain product details for one product.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
Try
Description
使用应用脚本以下示例脚本将每行并将包含
:
的所有行转换为表。此scipt的最终结果是所有和行的单字符串code.gs
执行日志
Description
Using App script the following example script will take each row and convert any rows that contain
:
into a table. The end result of this scipt is a single string of all the and linesCode.gs
Execution log