Complicated Excel Issue with Google API and Python - python

So I know how to download Excel files from Google Drive in .csv format. However, since .csv files do not support multiple sheets, I have developed a system in a for loop to add the '&grid=tab_number' to the file download url so that I can download each sheet as its own .csv file. The problem I have run into is finding out how many sheets are in the excel workbook on the Google Drive so I know how many times to set the for loop for.

Ended up just downloading with xlrd and using that. Thanks for the link Rob.

Related

python excel sheet saves as pdf

I want to save my excel sheets (there are more than 50 sheets) in a separate PDF file and each file name should be saved in the sheet name. I can do it by excel VBA but I was curious whether it can be done in python.
pywin32 will do the job for you. Please follow this link.

How can I update workbook links when using pd.read_excel()?

The question is pretty simple, actually.
I'm reading an Excel file using Pandas. When I open it using Office's Excel in my Desktop I'm prompted to Enable Content and then Update Links [that is, update values in those cells importing information from cells in other workbooks and xslx files], so it reads other files in some other folders.
While using pd.read_excel('filename') however that option is not available, and I'm afraid it's importing the data previously contained in the spreadsheet without updating it. Is there a workaround?

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.

save and close all currently open excel sheets (python)

I have another script that opens a bunch of excel sheets and exports a bunch of data to them. However, it is incapable of saving those documents automagically. Is there a way in python to grab all the currently open excel sheets, save them, and then close them?
What libraries are you using?
you can use
for each wb in xl.workbooks:
wb.close(true)

Categories

Resources