Skip to content

Commit 56fb5af

Browse files
committed
Only import openpyxl for Excel
1 parent dd5c07d commit 56fb5af

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

scripts/pyard-reduce-csv

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,14 @@ if __name__ == '__main__':
176176
verbose = ard_config["verbose_log"]
177177
white_space_regex = re.compile(r"\s+")
178178

179-
try:
180-
import openpyxl
181-
except ImportError:
182-
print("For Excel output, openpyxl library needs to be installed. "
183-
"Install with:")
184-
print(" pip install openpyxl")
185-
sys.exit(1)
179+
if ard_config["output_file_format"] == 'xlsx':
180+
try:
181+
import openpyxl
182+
except ImportError:
183+
print("For Excel output, openpyxl library needs to be installed. "
184+
"Install with:")
185+
print(" pip install openpyxl")
186+
sys.exit(1)
186187

187188
# Instantiate py-ard object with the latest
188189
ard = pyard.ARD()

0 commit comments

Comments
 (0)