Python - reading comments in xlsx - python

Is there any way to read comments in xlsx files using python?

openpyxl enables the manipulation of xlsx files and there is discussion here of adding the ability to access comments. If this does not work the comments for a given xlsx file can be accessed in xml format by renaming and unzipping the xlsx file as described here. This xml file can then be read by python.

Related

How to have a pandas DATAFRAME saved into a SHAREPOINT as csv file?

I have a DataFrame that I would like to store as a CSV file in a Sharepoint.
It seems that the only way is to first save CSV file locally and then, using Shareplum, upload file to Sharepoint.
Is there a way to directly save DataFrame into Sharepoint as CSV file, without creating a local file?
Thanks a lot for your help.
It should be possible to write the csv content to an in-memory text buffer (e.g. StringIO or ByteIO) rather than to a local file - here is an example (last section of the page).
After that, you could use a library for writing the content directly to a Sharepoint: This discussion shows several approaches how to do that, including the Office365-REST-Python-Client and also SharePlum, which you have already mentioned.
Here are two more sources (Microsoft technical doc) that you might find useful:
How can I upload a file to Sharepoint using Python?
How to get and upload files from sharepoint with python?

Adding the "isExportable" attribute to an excel xmlMaps.xml file

So for a previous question I asked how to add a custom made xmlMap to an excel file in python and I was "successful" by opening the xlsx file as an archive and extracting the file structure, followed by adding the xmlMaps.xml file to the structure and including it in the "rels". I can now open the excel file and see that the xml source map is attached, but I cannot export it. It mentions that I need to set the attribute "xmlmap.isExportable" to True, but I have no clue about how to do this, preferably using python.
All I have found on google is this: https://learn.microsoft.com/en-us/office/vba/api/excel.xmlmap.isexportable
My old question regarding the case: Adding XML Source to xlsx file in python
Any help is greatly appreciated
Best regards
Martin
Turns out I just needed to understand how a xlsx file works and how xml connections are stored and referenced throughout multiple sub files

Fetch defined_names from a .xls file

I'm trying to fetch tagged data from a .xls file.
I am able to fetch the tagged data from .xlsx file using Openpyxl, like this: [dn for dn in wb.defined_names.definedName]
But openpyxl does not support .xls format and I need to get the defined_names from .xls file as well.
Is there any library that can read .xls and return the defined_names in the file?
check xlrd package.
Here is the relevant part of the docs - Named references, constants, formulas, and macros

Convert excel sheets with images to PDF files

I'm trying to automate a process that converts excel files with single sheets having charts into pdf files using python. Any packages available that would help this task?
I have tried Excel Writer and other similar packages, it doesn't seem to work.
Reading the file using pandas doesn't work.
The source file has charts/images.
PDF file for each excel file is the desired output. Any suggestions would be welcome..

How do I read/write both xlsx and xls files in Python?

I have a web application (based on Django 1.5) wherein a user uploads a spreadsheet file.
I've been using xlrd for manipulating xls files and looked into openpyxl which claims to support xlsx/xlsm files.
So is there a common way to read/write both xls and xlsx files?
Another option could be to convert the uploaded file to xls and use xlrd. For this I looked into gnumeric and ssconvert, this would be favorable since all my existing code in written using xlrd and I will not have to change the existing codebase.
So should I change the library I use or go with the conversion solution?
Thanks in advance.
xlrd can read both xlsx and xls files, so it's probably simplest to use that. Support for xlsx isn't as extensive as openpyxl but should be sufficient.
There's a risk of losing information in converting xlsx to xls because xlsx files can be much larger.

Categories

Resources