Ошибка сохранения выходного файла Excel: 255 символов, так как он превышает ограничение Excel для URL - PullRequest
0 голосов
/ 10 января 2019

У меня проблема с сохранением данных в Excel из-за превышения лимита в 255 символов. Мне любопытно узнать решение этой конкретной проблемы для моего кода. Надеюсь, что кто-то может предложить и помочь:

Ниже приведен мой фрагмент кода xlsxwriter на 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=&registryCode=&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()

Результат сборки:

UserWarning: Ignoring URL 'http://ec.europa.eu/environment/ets/ohaDetails.do?returnURL=&languageCode=en&accountID=&registryCode=&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 Ответ

0 голосов
/ 10 января 2019

Мне любопытно узнать решение этой конкретной проблемы для моего кода.

Нет. Это ограничение Excel . Он позволяет использовать только до 255 символов!

...