IP Fabric Tables to Excel
In version 7.5.0 of the ipfabric Python SDK a new ipf_to_excel CLI tool was added.
After installing the package it can be run from the command line.
This has replaced ipfabric-tables-to-excel which is now deprecated.
Requirements
Required environment variables exported (IPF_URL and IPF_TOKEN or IPF_USERNAME & IPF_PASSWORD) or a
.env file located in the current working directory or your home directory.
Requires installing the ipfabric Python SDK with CLI dependencies: pip install ipfabric[cli].
Documentation
> ipf_to_excel -h
🚀 IP Fabric Tables to Excel Exporter! 🚀
usage: ipf_to_excel.cmd [-h] [-d hostname [hostname ...]] [-sn sn [sn ...]] [-P] [-D] [-f FILENAME] [-s SNAPSHOT] [-b BASE_URL] [-t TOKEN] [-u USERNAME] [-p PASSWORD] [-k] table [table ...]
Fetch tables from IP Fabric and insert into a single excel file with multiple sheets.
positional arguments:
table API or Front end URL for IP Fabric tables to fetch. Can be used multiple times.
options:
-h, --help show this help message and exit
-d hostname [hostname ...], --device-hostname hostname [hostname ...]
Device Hostname to fetch data for. Can be used multiple times; default to return all devices.
-sn sn [sn ...], --device-sn sn [sn ...]
Device Serial Number to fetch data for. Can be used multiple times; default to return all devices.
-P, --preview Print first 3 rows of each table fetched
-D, --device-separate
Creates a unique Excel Worksheet separately for each device for each table requested. Default is False and will return a single Worksheet for each table requested.
-f FILENAME, --filename FILENAME
Name or Path of the output file
-s SNAPSHOT, --snapshot SNAPSHOT
Snapshot to use which can be a UUID or one of ['last', 'prev', 'lastLocked']with or without `$` for *nix compatability.
-b BASE_URL, --base-url BASE_URL
Base URL for IPFabric API or IPF_URL env variable.
-t TOKEN, --token TOKEN
IP Fabric API Token or IPF_TOKEN env variable.
-u USERNAME, --username USERNAME
IP Fabric username (requires --password) or IPF_USERNAME env variable.
-p PASSWORD, --password PASSWORD
IP Fabric password or IPF_PASSWORD env variable.
-k, --insecure Disable SSL Verification.
Usage
Export multiple tables into a single Excel file with multiple sheets:
> ipf_to_excel tables/inventory/devices tables/inventory/interfaces
🚀 IP Fabric Tables to Excel Exporter! 🚀
Exporting data to excel...
Export complete. Check C:\Code\python-ipfabric\output.xlsx
👋 Bye!
Export multiple tables for specific device(s) based on hostname or IP Fabric unique serial number:
> ipf_to_excel tables/inventory/devices tables/inventory/interfaces -d NL2-R1 open_gear.123
> ipf_to_excel tables/inventory/devices tables/inventory/interfaces -sn 72082205170340 a010102
Export multiple tables for specific device(s) based on hostname and create separate Worksheets for each device table combination:
> ipf_to_excel tables/inventory/devices tables/inventory/interfaces -d NL2-R1 open_gear.123 -D
🚀 IP Fabric Tables to Excel Exporter! 🚀
Exporting data to excel...
Sheet name open_gear.123-Interface Inventory is too long. Truncating to 31 characters.
Export complete. Check C:\Code\python-ipfabric\output.xlsx
👋 Bye!


