How to Import XML into Spreadsheet with Python? - python

As the title suggests, how can I import a XML file into Spreadsheet with Python. I need for documenting High Level Router Configurations in a Spreadsheet format.
I have been using xlsxwriter to create spreadsheet etc, but have no idea how to put xml files into spreadsheet

Related

Creating an html report with columns and rows from csv

I have a question for you, I'm working on a new jenkins instance and as a result of the job I get a csv file with errors if there were any during the test. I would like to generate an HTML report based on this csv file, which would be more convenient to use than opening excel and loading the csv file to see the errors. I came across a plugin like HTML Publisher, unfortunately I don't know if it supports generating HTML reports based on csv files. Alternatively, you could do something like this with a python script and show the resulting html file in artifats. Do you have any ideas ??

export dataframe excel directly to sharepoint (or a web page)

I created a dataframe to jupyter notebook and I would like to export this dataframe directly to sharepoint as an excel file. Is there a way to do that?
As per the other answers, there doesn't seem to be a way to write a dataframe directly to SharePoint at the moment, but rather than saving it to file locally, you can create a BytesIO object in memory, and write that to SharePoint using the Office365-REST-Python-Client.
from io import BytesIO
buffer = BytesIO() # Create a buffer object
df.to_excel(buffer, index=False) # Write the dataframe to the buffer
buffer.seek(0)
file_content = buffer.read()
Referencing the example script upload_file.py, you would just replace the lines reading in the file with the code above.
You can add the SharePoint site as a network drive on your local computer and then use a file path that way. Here's a link to show you how to map the SharePoint to a network drive. From there, just select the file path for the drive you selected.
df.to_excel(r'Y:\Shared Documents\file_name.xlsx')
I think there is no way directly export pandas dataframe data to sharepoint but you can export your pandas data to excel and then upload the excel data to sharepoint
Export Covid data to Excel file
df.to_excel(r'/home/noh/Desktop/covid19.xls', index=False)

Reading Metadata/Properties from Excel Files using Python

I am in an effort to parse metadata out of Excel files. I have tried openpyxl, but that does not give me the desired results.
I would like to read the Company Name and Author Name from properties.
Thank You
This is the information I am trying to parse

Upload CSV to Google Sheets using gspread

I have a Json object which needed to be uploaded to the Google Spreadsheet. I have searched and read various resources but could not find the solution. Is there a way to upload object or csv from locally to google spreadsheet using gspread. I will prefer not to use google client api. Thanks
You can import CSV data using gspread.Client.import_csv method. Here's a quick example from the docs:
import gspread
# Check how to get `credentials`:
# https://github.com/burnash/gspread
gc = gspread.authorize(credentials)
# Read CSV file contents
content = open('file_to_import.csv', 'r').read()
gc.import_csv('<SPREADSHEET_ID>', content)
This will upload your CSV file into the first sheet of a spreadsheet with <SPREADSHEET_ID>.
NOTE
This method removes all other worksheets and then entirely replaces the contents of the first worksheet.

Scrape data in csv format without downloading csv file

I am trying to scrape data (using python) ,from google sheet, in csv format,without downloading the csv file. My aim is to update a database in mysql after getting information from google sheets.
Downloading the csv file would make me download the csv file again and again ,whenever the google sheet gets updated.
I have tried to use csv_reader(open('')) and putting the url of the google sheet in csv format(the link that we get after publishing to the web in csv format).
But it shows it as an invalid argument.
Can someone help me with this?

Categories