Python Forum
Unable to read data from string base64 representing a .xlsx file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to read data from string base64 representing a .xlsx file
#3
(Apr-05-2018, 04:55 PM)Gribouillis Wrote: You most likely need to remove the data:;base64, part in xlStr. You can try
xlStr = xlStr.split(',', 1)[1]
xlDecoded = base64.b64decode(xlStr)

You have made my day sir.... that solved the problem and saved my ass :'):

xlStr = xlStr.split(',', 1)[1]
xlDecoded = base64.b64decode(xlStr)
xlsx = xlrd.open_workbook(file_contents=xlDecoded)
firstSheet = xlsx.sheet_by_index(0)

print(firstSheet.cell(1,0).value)

#It printed and worked perfectly as intended....
Reply


Messages In This Thread
RE: Unable to read data from string base64 representing a .xlsx file - by max - Apr-05-2018, 07:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to read a file as binary or hex "string" so that I can do regex search? tatahuft 3 1,377 Dec-19-2024, 11:57 AM
Last Post: snippsat
  Unable to understand the function string.split() Hudjefa 8 3,016 Sep-16-2024, 04:25 AM
Last Post: Pedroski55
  Read TXT file in Pandas and save to Parquet zinho 2 1,439 Sep-15-2024, 06:14 PM
Last Post: zinho
  Pycharm can't read file Genericgamemaker 5 1,835 Jul-24-2024, 08:10 PM
Last Post: deanhystad
  Python is unable to read file Genericgamemaker 13 4,443 Jul-19-2024, 06:42 PM
Last Post: snippsat
  Connecting to Remote Server to read contents of a file ChaitanyaSharma 1 3,541 May-03-2024, 07:23 AM
Last Post: Pedroski55
  Help with to check an Input list data with a data read from an external source sacharyya 3 1,860 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  Recommended way to read/create PDF file? Winfried 3 5,519 Nov-26-2023, 07:51 AM
Last Post: Pedroski55
  python Read each xlsx file and write it into csv with pipe delimiter mg24 4 4,159 Nov-09-2023, 10:56 AM
Last Post: mg24
  Need to replace a string with a file (HTML file) tester_V 1 2,045 Aug-30-2023, 03:42 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020