-
Administrator
Reputation: 1403
3 out of 3 members found this post helpful.
Python scripts for combining excel files
I use this scripts to combined OSS stats from multiple Huawei PRS.
Hope it helps.
written in python 3
Code:
import pandas as pdimport os
import datetime
rootDir = os.getcwd()
filelist = []
excellist = []
today = datetime.date.today()
delta = datetime.timedelta(days=-1)
yesterday = today + delta
startDate = yesterday.strftime('%Y%m%d')
#get all xlsx files
for filename in os.listdir(rootDir):
if os.path.splitext(filename)[1] == '.xlsx':
filelist.append(filename)
#file name of combined file
filename_combined = startDate + 'Huawei All.xlsx'
writer = pd.ExcelWriter(filename_combined)
#read info to list
for excelfile in filelist:
excellist.append(pd.read_excel(excelfile))
#write combined info to excel file
newdf = pd.concat(excellist,sort=False)
newdf.to_excel(writer,index=False)
#save excel file
writer.save()
-
Post Thanks - 3 Thanks
-
2018-12-04 04:24 PM
# ADS
Circuit advertisement
-
Re: Python scripts for combining excel files
Or you can try "Power query" which is a EXCEL plug-in published by Microsoft
it is free and it has lots of training material on internet
-
Post Thanks - 1 Thanks
-
VIP Member
Reputation: 1852
Re: Python scripts for combining excel files
the beauty of scripts,
in that they do all your work at night,
often on Ubuntu Server,
also add a couple of lines to the weekly report ))
-
Member
Reputation: 83
Re: Python scripts for combining excel files
Originally Posted by
BlackX
Or you can try "Power query" which is a EXCEL plug-in published by Microsoft
it is free and it has lots of training material on internet
agree totally i user power query since two years now , its really powerfull , i even stopped using PRS
-
Senior Member
Reputation: 373
Re: Python scripts for combining excel files
Hi,
I'm very fluent in python, but I prefer to use Power BI to do this kind of work. My reasons:
1. Very intuitive
2. Anyway after you combine the files I would like to make some chart
3. Visualizations a very beautiful (not just the boring Excel charts we have like 20 years seeming)
3. Power BI charts are dynamic, that means you can create for example a map to show sites by clicking a table
4. It is also FREE
-
Post Thanks - 1 Thanks
-
Member
Reputation: 238
Re: Python scripts for combining excel files
@jkpllan3
could share some video or tutorial to do it with Power BI , it will be very helpful
I mean how you are Power BI in RF
Last edited by Boraa; 2018-12-08 at 04:21 PM
-
Member
Reputation: 83
Re: Python scripts for combining excel files
Originally Posted by
Boraa
@
jkpllan3
could share some video or tutorial to do it with Power BI , it will be very helpful
I mean how you are Power BI in RF
https://www.edx.org/course/analyzing...soft-dat207x-0
-
Post Thanks - 2 Thanks
Bookmarks