How can I adjust the measurement of the cells in the .csv/.xlsx file?
JavaScript
x
20
20
1
# Modules
2
import datetime, os, sys
3
import urllib.request as request
4
import pandas as pd
5
6
#Sort Values From URL
7
Application_value = "org.thoughtcrime.securesms"
8
Version_value = "3.2.15"
9
print(Application_value)
10
11
#Insert into file.txt
12
with open("log.csv", "a") as file:
13
#content = str("Application_value") + ',' + str("Version_value") + 'n'
14
content = str(Application_value) + ',' + str(Version_value) + 'n'
15
print("Appended!")
16
file.write(content)
17
file.close()
18
df = pd.read_csv('log.csv')
19
df.to_excel('recordings.xlsx', 'Sheet1')
20
Let’s say I wanted the cell of the first entry to be 25px or a similar measurement.
Advertisement
Answer
You can access to workbook and active sheet through ExcelWriter
:
JavaScript
1
4
1
with pd.ExcelWriter('output.xlsx', engine='openpyxl') as writer:
2
df.to_excel(writer, sheet_name='Sheet1', index=False)
3
writer.book.active.column_dimensions['A'].width = 25
4