title: Convert an excel range into an image using python
body: <p>I'm trying to convert a range in an excel file into an image. I tried using the xlwings method but it didn't work because my os is Linux and Linux does not support that package. I also tried the excel2image method but it also didn't work. I even tried converting the datafame to an html file (instead of an excel file) then convert that to an image but both packages I used (html2image &amp; imgkit) are not supported on Linux. Does anyone know a method that will work on Linux? I know that you can convert dataframes to images but the styling options for dataframes are very limited.</p>
  <p>here is the code I used</p>
  <p>1st method using xlwings</p>
  <pre><code>wb = xw.Book(file_path)
  sheet = wb.sheets[0]
  img_range = &quot;B2:F26&quot;
  
  xw.Range(img_range).api.copy_picture()
  sheet.api.paste()
  pic = sheet.pictures[0]
  
  img = ImageGrab.grabclipboard()
  img_name = image_1
  img.save(img_name + &quot;.png&quot;)
  pic.delete()
  
  wb.close()
  </code></pre>
  <p>I got this error: xlwings.XlwingsError: Your platform only supports the instantiation via xw.Book(json=...).
  By the way, this worked perfectly when I tried it on a mac !</p>
  <p>I even tried to add: app = xw.app() but I got the following error:
  app = xw.app() AttributeError: 'NoneType' object has no attribute 'apps'</p>
  <p>2nd method using excel2img</p>
  <pre><code>import excel2img
  excel2img.export_img(file_path, img_name, &quot;B2:F26&quot;)
  </code></pre>
  <p>This one didn't work because this package works only with windows</p>