Created
April 7, 2020 17:46
Python Pyoo script to find the unique items in a column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Tested on python 3.6 | |
""" | |
import pyoo | |
path="/media/satish/5229e5b6-0b7b-44ef-a609-5aaf186c6bc4/data/pro_g/python/pyoo/test.ods" | |
desktop = pyoo.Desktop('localhost', 2002) | |
doc = desktop.open_spreadsheet(path) | |
sheet = doc.sheets[0] | |
column=input('Enter the column header of which unique elements are needed \n') | |
sheet = doc.sheets[0] | |
col=0 | |
while (sheet[0,col].value != column): | |
col=col+1 | |
i=0 | |
addr1=str(sheet[1,col].address) | |
while(sheet[i,col].value != ''): | |
i=i+1 | |
last=i | |
x=sheet[1:last,col].values | |
unique=list(set(x)) | |
size=len(unique) | |
print("There are " + str(size) +" unique values") | |
for i in unique: | |
print(int(i)) | |
doc.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment