Getting Started
After you installed this package, the next step is to import the package into your code and start using the functions.
from botcity.plugins.excel import BotExcelPlugin
As a demonstration of the library, let's build a simple example together that will do something cool .
Step 1 of Example
To make the example we will...
# Instantiate the plugin
bot_excel = BotExcelPlugin()
...
Step 2 of Example
# Read from a CSV File, add a row, then sort it
bot_excel.read('read.xlsx')
bot_excel.add_row([0, 22])
bot_excel.sort(['A', 'B'], False)
# Print the result and save it to a CSV file
print(bot_excel.as_list())
bot_excel.write('write.xlsx')
...
Complete code
Let's take a look into the complete code:
from botcity.plugins.excel import BotExcelPlugin
# Instantiate the plugin
bot_excel = BotExcelPlugin()
# Read from a CSV File, add a row, then sort it
bot_excel.read('read.xlsx')
bot_excel.add_row([0, 22])
bot_excel.sort(['A', 'B'])
# Print the result and save it to a CSV file
print(bot_excel.as_list())
bot_excel.write('write.xlsx')
...
Pro Tip
This plugin allow you to use method chaining
so the code above could be written as:
print(BotExcelPlugin().read('read.xlsx').add_row([0, 22]).sort(['A', 'B']).as_list())
...
Next Steps
Check our examples and experiment with the API. Let us know where it can be improved.
Have fun automating!