change output file name and key path
This commit is contained in:
@@ -4,11 +4,12 @@ from firebase_admin import credentials
|
|||||||
from firebase_admin import firestore
|
from firebase_admin import firestore
|
||||||
from google.cloud.firestore_v1.base_query import FieldFilter
|
from google.cloud.firestore_v1.base_query import FieldFilter
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import datetime
|
#import datetime
|
||||||
import sys
|
import sys
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
# Initialize Firebase Admin SDK
|
# Initialize Firebase Admin SDK
|
||||||
cred = credentials.Certificate(os.getcwd() + '/keys/hpos-prod-firebase-adminsdk-bionp-3c041b2300.json') # Replace with your own service account key path
|
cred = credentials.Certificate(os.getcwd() + '/keys/hpos-prod-firebase-adminsdk.json') # Replace with your own service account key path
|
||||||
firebase_admin.initialize_app(cred)
|
firebase_admin.initialize_app(cred)
|
||||||
|
|
||||||
# Get a reference to the Firestore database
|
# Get a reference to the Firestore database
|
||||||
@@ -55,12 +56,12 @@ print(df.size)
|
|||||||
print("duplicates", len(df['_id']) - len(df['_id'].drop_duplicates()))
|
print("duplicates", len(df['_id']) - len(df['_id'].drop_duplicates()))
|
||||||
|
|
||||||
# Save the DataFrame to a CSV file
|
# Save the DataFrame to a CSV file
|
||||||
output_filename = "data.csv"
|
output_filename = f'users_{datetime.today().strftime("%d_%m_%Y_%H_%M")}.xlsx'
|
||||||
df.to_csv(output_filename, index=False)
|
df.to_excel(output_filename, index=False)
|
||||||
|
|
||||||
downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads")
|
downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads")
|
||||||
output_path = os.path.join(downloads_dir, output_filename)
|
output_path = os.path.join(downloads_dir, output_filename)
|
||||||
df.to_csv(output_path, index=False)
|
df.to_excel(output_path, index=False)
|
||||||
|
|
||||||
print(f"Data saved to '{output_path}'")
|
print(f"Data saved to '{output_path}'")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user