I use Confluence REST API in Python script to read a table in Confluence page. This part is working fine as expected. Below is my Python script:
url = 'https://ConflunecePageLocation/rest/api/content/ContentIDNumber?
expand=body.view'
response = requests.get(url,verify=False,auth=headeroauth)
print(response.status_code)
data=response.text
df=pd.read_html(data,flavor='lxml')
df3=pd.DataFrame(df[0])**
Once I get the dataframe I use write into an Excel file.
Say I want to update the same table which is in Confluence page with a dataset from an Excel file - for example the table in Confluence page has 50 records in it and I want to add at the end of the table like 5 rows with exact columns - these 5 rows are in an Excel file -append the table in Confluence with the 5 rows.
I have found 1 or 2 links where they are talking about the data that needs to be updated should be in HTML format. I don't want to make so complicated this way.
I use Confluence REST API in Python script to read a table in Confluence page. This part is working fine as expected. Below is my Python script:
url = 'https://ConflunecePageLocation/rest/api/content/ContentIDNumber?
expand=body.view'
response = requests.get(url,verify=False,auth=headeroauth)
print(response.status_code)
data=response.text
df=pd.read_html(data,flavor='lxml')
df3=pd.DataFrame(df[0])**
Once I get the dataframe I use write into an Excel file.
Say I want to update the same table which is in Confluence page with a dataset from an Excel file - for example the table in Confluence page has 50 records in it and I want to add at the end of the table like 5 rows with exact columns - these 5 rows are in an Excel file -append the table in Confluence with the 5 rows.
I have found 1 or 2 links where they are talking about the data that needs to be updated should be in HTML format. I don't want to make so complicated this way.
Share Improve this question edited Mar 6 at 17:57 jonrsharpe 122k30 gold badges268 silver badges476 bronze badges asked Mar 6 at 17:30 RajRaj 32 bronze badges1 Answer
Reset to default 0The content of the page you have read in response.text
is in HTML, so you have to locate the table and replaced with the new one. Replacing the entire table would be simpler than just adding 5 rows, however both approaches are possible.
Once you have the new HTML, you need to update the page using
PUT /rest/api/content/<PAGEID>
and providing the payload containing your changes.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744958869a4603365.html
评论列表(0条)