mdbq 1.7.6__py3-none-any.whl → 1.7.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mdbq/company/copysh.py CHANGED
@@ -250,6 +250,15 @@ class TbFiles:
250
250
  else:
251
251
  print(f'{src} 所需同步的文件不存在,请检查:pd_list参数')
252
252
 
253
+ excel_path = os.path.join(self.share_path, 'EXCEL报表')
254
+ files = os.listdir(excel_path)
255
+ for file in files:
256
+ if file.endswith('.xlsx'):
257
+ now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
258
+ print(f'正在刷新 excel: {file}')
259
+ r.refresh_excel2(excel_file=os.path.join(excel_path, file))
260
+ time.sleep(10)
261
+
253
262
  self.before_max_time = self.check_change() # 重置值, 避免重复同步
254
263
 
255
264
  now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
mdbq/pbix/refresh_all.py CHANGED
@@ -17,7 +17,7 @@ class RefreshAll:
17
17
  def __init__(self):
18
18
  self.my_conf = os.path.join(set_support.SetSupport(dirname='support').dirname, '.my_conf')
19
19
  self.pbix_path = os.path.join(set_support.SetSupport(dirname='support').dirname, 'ref_list.txt')
20
- self.excel_path = os.path.join(set_support.SetSupport(dirname='support').dirname, 'cp_list.txt')
20
+ self.excel_path = os.path.join(set_support.SetSupport(dirname='support').dirname, 'ref_list.txt')
21
21
  self.run_py_path = 'run_py'
22
22
  self.procname = 'PBIDesktop.exe'
23
23
 
@@ -84,6 +84,31 @@ class RefreshAll:
84
84
  except Exception as e:
85
85
  print(e)
86
86
 
87
+ def refresh_excel2(self, excel_file):
88
+ # 刷新 excel
89
+ if excel_file.endswith('.xlsx'):
90
+ try:
91
+ print(f'正在刷新 >>>{excel_file}')
92
+ xlapp = win32com.client.Dispatch('Excel.Application') # 创建Excel程序App
93
+ xlapp.Visible = False # 窗口是否可见
94
+ xlapp.DisplayAlerts = False # 是否显示警告信息
95
+ wb = xlapp.Workbooks.Open(excel_file)
96
+ conjuncts = wb.Connections.Count # 统计工作簿含有多少外部链接
97
+ if conjuncts == 0:
98
+ wb.Close(SaveChanges=False)
99
+ xlapp.Quit()
100
+ else:
101
+ time.sleep(2)
102
+ wb.RefreshAll()
103
+ xlapp.CalculateUntilAsyncQueriesDone()
104
+ time.sleep(2)
105
+ wb.Save()
106
+ wb.Close(SaveChanges=True)
107
+ xlapp.Quit()
108
+ print('文件刷新 >>>' + excel_file)
109
+ except Exception as e:
110
+ print(e)
111
+
87
112
  def pbi(self, path, _timeout=300):
88
113
  """
89
114
  这是原本属于独立的库模块: pbix_refresh
@@ -146,7 +171,7 @@ class RefreshAll:
146
171
 
147
172
 
148
173
  if __name__ == '__main__':
149
- # r = RefreshAll()
174
+ r = RefreshAll()
150
175
  # r.refresh_pbix()
151
- # r.refresh_excel()
176
+ r.refresh_excel()
152
177
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 1.7.6
3
+ Version: 1.7.7
4
4
  Home-page: https://pypi.org/project/mdbsql
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -11,7 +11,7 @@ mdbq/bdup/bdup.py,sha256=LAV0TgnQpc-LB-YuJthxb0U42_VkPidzQzAagan46lU,4234
11
11
  mdbq/clean/__init__.py,sha256=A1d6x3L27j4NtLgiFV5TANwEkLuaDfPHDQNrPBbNWtU,41
12
12
  mdbq/clean/data_clean.py,sha256=T0WYOKFwNZTNk3temKOw1K2H54kxu9QBJjlTbkMtxNk,94217
13
13
  mdbq/company/__init__.py,sha256=qz8F_GsP_pMB5PblgJAUAMjasuZbOEp3qQOCB39E8f0,21
14
- mdbq/company/copysh.py,sha256=WCZ92vCJAy6_ZFeOxWL-U9gArIpyga4xts-s1wKsspY,17268
14
+ mdbq/company/copysh.py,sha256=eoi8X8lFQJC3klIHdZX4uSFiGjHF2zU6aQtxPRqoALw,17681
15
15
  mdbq/config/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
16
16
  mdbq/config/get_myconf.py,sha256=-CFEW0dQh4OIwVgwK-cL0eVp1LN3PjJgN89d4P5TB9I,6011
17
17
  mdbq/config/products.py,sha256=vIK8DJ-F3XXwvNPK-4OJq2tZITNlL6Sub8QBdoOng8U,5676
@@ -33,9 +33,9 @@ mdbq/other/pov_city.py,sha256=AEOmCOzOwyjHi9LLZWPKi6DUuSC-_M163664I52u9qw,21050
33
33
  mdbq/other/ua_sj.py,sha256=JuVYzc_5QZ9s_oQSrTHVKkQv4S_7-CWx4oIKOARn_9U,22178
34
34
  mdbq/pbix/__init__.py,sha256=Trtfaynu9RjoTyLLYBN2xdRxTvm_zhCniUkVTAYwcjo,24
35
35
  mdbq/pbix/pbix_refresh.py,sha256=JUjKW3bNEyoMVfVfo77UhguvS5AWkixvVhDbw4_MHco,2396
36
- mdbq/pbix/refresh_all.py,sha256=tgy762608HMaXWynbOURIf2UVMuSPybzrDXQnOOcnZU,6102
36
+ mdbq/pbix/refresh_all.py,sha256=sBZ61LKvm-raa9ROnC-AAvPYLU7dbudmuxy__5QCB2A,7176
37
37
  mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
38
- mdbq-1.7.6.dist-info/METADATA,sha256=QzujGJTSxIt0YV7h24bB6lTwt0Tw7QNStfyJncdGqxY,245
39
- mdbq-1.7.6.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
40
- mdbq-1.7.6.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
41
- mdbq-1.7.6.dist-info/RECORD,,
38
+ mdbq-1.7.7.dist-info/METADATA,sha256=mTTjphRDU11c71JZTPygknfodts70so1MGTLfGRyczI,245
39
+ mdbq-1.7.7.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
40
+ mdbq-1.7.7.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
41
+ mdbq-1.7.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.0)
2
+ Generator: bdist_wheel (0.44.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5