This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# payroll_steve_jeff.py | |
# Report payrates for two employees across multiple spreadsheets | |
# | |
import win32com.client as win32 | |
import glob | |
import os | |
xlfiles = sorted(glob.glob("*.xls")) | |
print "Reading %d files..."%len(xlfiles) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# erppivotdragdrop.py: | |
# Load raw EPR data, clean up header info, | |
# insert additional data fields and build 5 pivot tables | |
# Support drag and drop of multiple spreadsheets | |
# | |
import win32com.client as win32 | |
win32c = win32.constants | |
import sys | |
import itertools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# erppivotextended.py: | |
# Load raw EPR data, clean up header info, | |
# insert additional data fields and build 5 pivot tables | |
# | |
import win32com.client as win32 | |
win32c = win32.constants | |
import sys | |
import itertools | |
tablecount = itertools.count(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# erpdatapivot.py: | |
# Load raw EPR data, clean up header info and | |
# build 5 pivot tables | |
# | |
import win32com.client as win32 | |
win32c = win32.constants | |
import sys | |
import itertools | |
tablecount = itertools.count(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' | |
' Macro2 Macro | |
' | |
' | |
Selection.CurrentRegion.Select | |
Sheets.Add | |
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ | |
"Sheet2!R1C1:R791C13", Version:=xlPivotTableVersion10).CreatePivotTable _ | |
TableDestination:="Sheet3!R3C1", TableName:="PivotTable1", DefaultVersion _ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# erpdata.py: Load raw EPR data and clean up header info | |
# | |
import win32com.client as win32 | |
import sys | |
excel = win32.gencache.EnsureDispatch('Excel.Application') | |
#excel.Visible = True | |
try: | |
wb = excel.Workbooks.Open('ABCDCatering.xls') | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# conditionalformatting.py | |
# Create two tables and apply Conditional Formatting | |
# | |
import win32com.client as win32 | |
excel = win32.gencache.EnsureDispatch('Excel.Application') | |
#excel.Visible = True | |
wb = excel.Workbooks.Add() | |
ws = wb.Worksheets('Sheet1') | |
ws.Range("B2:K2").Value = [i for i in range(1,11)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Macro1() | |
' | |
' Macro1 Macro | |
' | |
Range("B2:K22").Select | |
Selection.FormatConditions.AddColorScale ColorScaleType:=3 | |
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority | |
Selection.FormatConditions(1).ColorScaleCriteria(1).Type = _ | |
xlConditionValueLowestValue | |
With Selection.FormatConditions(1).ColorScaleCriteria(1).FormatColor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Set row heights and align text within the cell | |
# | |
import win32com.client as win32 | |
excel = win32.gencache.EnsureDispatch('Excel.Application') | |
wb = excel.Workbooks.Add() | |
ws = wb.Worksheets("Sheet1") | |
ws.Range("A1:A2").Value = "1 line" | |
ws.Range("B1:B2").Value = "Two\nlines" | |
ws.Range("C1:C2").Value = "Three\nlines\nhere" |