写入excel fi时超过URL数

2024-06-17 11:16:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我收到这个警告WARNING: C:\Users\diodi\AppData\Local\Programs\Python\Python37-32\lib\site-packages\xlsxwriter\worksheet.py:923: UserWarning: Ignoring URL 'https://www.google.com/search?q=hello+world' since it exceeds Excel's limit of 65,530 URLS per worksheet. "65,530 URLS per worksheet." % force_unicode(url))

我用它来写刮取数据的输出

#spider.found_items is a list of dictionary
df = pd.DataFrame(spider.found_items)[ordered_list] #ordered_list is the order of dictiornary outputed
df.to_excel("{}.xlsx".format(file_name),sheet_name='All Products')

我选中了这个Number of URLS is over Excel's limit of 65,530 URLS per worksheet.,但这会将链接格式化为字符串(不可单击)。如果我可以写多个工作表或任何其他建议,有没有办法保留URL(作为链接)?在


Tags: ofnameurldfisitemsexcelurls
1条回答
网友
1楼 · 发布于 2024-06-17 11:16:04

从根本上说,这是Excel的局限性。每个工作表只允许65530个unique*url。没有任何解决办法。在

(*)Excel允许超过65530个非唯一URL,如果它们是连续分组的。例如,单元格A1到A100中的同一个url在65530的限制下只被计算为一个url。然而,XlsxWriter不支持对url进行分组以利用这一点(即使是这样,如果所有url都是唯一的或不连续的,也没有帮助)。

相关问题 更多 >