问题
I am having an issue where the data is not being saved in excel due to exceeding limit of 255 characters of URL value. I am curious to know the solution to this specific problem for my code. Hope someone could suggest and help:
Below is my piece of xlsxwriter code in python:
import xlsxwriter
from openpyxl import load_workbook
workbook =xlsxwriter.Workbook('Output.xlsx')
worksheet = workbook.add_worksheet()
row = 0
col = 0
data = []
url = "http://ec.europa.eu/environment/ets/ohaDetails.do?returnURL=&languageCode=en&accountID=®istryCode=&buttonAction=all&action=&account.registryCode=&accountType=&identifierInReg=&accountHolder=&primaryAuthRep=&installationIdentifier=&installationName=&accountStatus=&permitIdentifier=&complianceStatus=&mainActivityType=-1&searchType=oha&backList=%3C%C2%A0Back&resultList.currentPageNumber=1007&selectedPeriods="
data.append(url)
worksheet.write_row(row, col, tuple(data))
workbook.close()
Build Result:
UserWarning: Ignoring URL 'http://ec.europa.eu/environment/ets/ohaDetails.do?returnURL=&languageCode=en&accountID=®istryCode=&buttonAction=all&action=&account.registryCode=&accountType=&identifierInReg=&accountHolder=&primaryAuthRep=&installationIdentifier=&installationName=&accountStatus=&permitIdentifier=&complianceStatus=&mainActivityType=-1&searchType=oha&backList=%3C%C2%A0Back&resultList.currentPageNumber=1007&selectedPeriods=' with link or location/anchor > 255 characters since it exceeds Excel's limit for URLS
force_unicode(url))
回答1:
I am curious to know the solution to this specific problem for my code.
No. This is an Excel limitation. It only allows urls up to 255 characters!
来源:https://stackoverflow.com/questions/54135602/excel-output-file-saving-error-255-characters-since-it-exceeds-excels-limit-fo