How to read and write data in Microsoft excel 2010 in python - python-2.7

Steps what I have done
1.Reading input data from xlsx file
2.calculated week number and total hours done by each department
Need to do:
1.Reading particular row column from another existing xlsx sheet
2.writing total hours for each department in existing xlsx sheet
I am using xlutils but format of xlsx file has been corrupted,which library i should use for this?

According to
http://www.python-excel.org/
, the best library to read/write Excel 2010 files is openpyxl.

Related

Union Data Power BI

new to Power BI and just built a dashboard with some finance data with the following columns,
Date|Transaction ID|Transaction Amount|Item Description|Item Key
Every month I receive a new CSV file with data for the previous month. Rather than manually adding the new data to a master file each month, is there a way to simply drop the new CSV file into a folder each month and then refresh the dashboard so it automatically includes the new data (minus the headers)? If possible, I'd also like to add a column which holds the date the new file was loaded, so each new month's file is date stamped each time it's added.
Many thanks
What you can do is use a folder as a source instead of a csv.
That folder should contain all csv files.
When all your files are load you only have to select the following option:
After that you will have all the data from the all csv files in one gigant table.
Unfortunately its not possible to add a date column with the load date.
The only way to do that is that the csv files have the date column.
Hope it helps you.

Power BI - Use slicer to fetch file from folder

I have files in a folder which have same structure. The only difference between them is that for each day a new file is created which is named as date of the day.
So if file is created on 11th November 2019, its name would be 11092019.xlsx.
I have created a slicer which fetches names of all files present in this folder.
Keeping in mind that file format is same and only difference is in their file name and data values in them. Is there any way so that when I select a value from slicer the respective files data will be displayed in table visual ?
It is not possible to load a file interactively based on the slicer value.
You can achieve this by,
Load all files in the folder.
Combine them into a single table, where you need to add a "File Name" column.
Use slicer to show records coming from the specific file.

Update old excel from New by keeping the formatting with python

I am trying to update old excel file with new one with the data by comparing date in two excel files.
Objective is to update the previous dates columns and add new dates found in new excel into the old excel.
Also copy the formatting from old column into new columns that were added.
What I did, I tried to merge the dataframes from two excels. I still do need help on the logic.
Excel Old File
Excel New File
Please someone help in this
The formatting is kind of worth a separate question.
Here's my approach to the merge that i think you are seeking.
In quick summary we use combine_first()
df_old_excel = pd.read_excel(r'C:\temp\Excel_Old_File.xlsx',header =1)
df_new_excel = pd.read_excel(r'C:\temp\Excel_New_File.xlsx',header =1)
df_old_excel = df_old_excel.set_index('DATE')
df_new_excel.index = df_old_excel.index
df_new_excel.combine_first(df_old_excel)

Django lib to create xls-files over 65k rows?

Is there an excel-lib for Django, whom doesn’t put a limit at 65k+ rows?
Or plan B: dirty workaround to make xlwt produce the desired files?
You need to use the new Excel format, xlsx, instead of the old one with xls extension. After Excel 2007 the 65.000 row limit was increased to 1 million rows. Unfortunately, I don't know about Django and I can't suggest any library to produce the new Excel format.

How to plot a graph in excel work sheet using c++ in windows mobile platform?

How can i plot a graph for the particular data in the same excel sheet using c++ in windows mobile platform?
For example:
I have an excel sheet say ItemDetails.xls with an header as "Date" & "Item Count" as mentioned below:-
Date Item Count
02-06-13 20
03-06-13 15
04-06-13 10
05-06-13 5
How can I plot a graph for the above data in the same excel sheet i.e. ItemDetails.xls?
Thanks in advance.
You can not automate excel on windows mobile cause it does not expose an excel obejct as on desktop PC. There are alternative third party tools.
Why use excel? Such imple graph can be created with simple drawing commands or in javascript on a web page.
Maybe save your excel file into csv format first so that your c++ will be able to read it easily.