libraries django to read, analize and create xlsx-csv files - python

I must create a web app with django that reads an xlsx file, a csv file and after their "data analysis" create a third xlsx file that contains the results of the data analysis.
My question is that: which libraries may I use to do that?

I recommend you to use xlrd https://pypi.python.org/pypi/xlrd library.

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?

Add new data to existing SharePoint xlsx files

I would like to write into an existing xlsx file in SharePoint. Is that even possible? Mydata is in the form of a dataframe and if possible, just append the dataframe instead of overwriting the whole xlsx file. I tried to use xlsxwriter library but did not get anywhere. Any help would be appreciated
#Coder123,
As you're using SP Online, you could update the content of xlsx file stored in SPO via MS Graph API:
https://learn.microsoft.com/en-us/graph/api/table-update?view=graph-rest-1.0&tabs=http
through this API, you can update the table/worksheet of an xlsx file. And it has offered a python library:
https://github.com/microsoftgraph/msgraph-sdk-python-core

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

What is best way to get CSV file data into database? Python (Falcon), Angular, MySQL

Currently I am working in a project where user will be able to upload a CSV file and the data in CSV file will be stored into database. This project is developing on Falcon Framework as back-end where API requests are sending from client side Angular 4.
From Angular side, I can parse CSV file data into JSON data. There are some packages available as example ngx-papaparse. Is there other way around like getting CSV file in python and process CSV file data to be stored into database. Then what is the best way to do.
Python is quite flexible for processing data, you may also convert your csv data to json using Pandas in python
import pandas as pd
df = pd.read_csv('filename.csv')
df.to_json('jsonfilename.json')
You can also store csv files in mysql by exporting them using python , please read http://www.vallinme.com/v1/?p=95
Petl is another library for such purpose.

How to read in tableau (twbx) file into python?

I would like to produce some custom output with python with data from Tableau files. I dont have access to the Tableau server to run the 'Tabpy' library.
Is there any other way to do it?
Thank you in advance
You may find the following link useful.
https://community.tableau.com/thread/152463
One of the posts in the thread mentioned the following which is worth exploring:
If you're looking to generate a TWBX dynamically, you should rename
your .twbx file to .zip, extract the contents and you can do whatever
you want with those in Python to dynamically create or adjust a
workbook file. The structure / definition of the workbook file is just
XML so no special code needed to read and parse that.

Categories

Resources