title: Add-Ins for Office365: inserting data into an excel sheet from a task-pane add-in
body: <p>I must be missing something:</p>
  
  <p>[problem]:</p>
  
  <p>I have a 2-dimensional array of data, that i would like to insert into the current sheet starting from cell A1. I also have to format this data.
  The current document may be empty or not. I do not have control over this.</p>
  
  <p>At a later point, i need to remove the data from the document and insert new data. This new set of data may have different dimensions.</p>
  
  <p>This seems to be impossible to do using the Office JavaScript Api.</p>
  
  <p>All the things I tried using TableBindings, etc. have failed. In many cases, functionality that should work according to MSDN failed, giving me cryptic error messages such as "internal error" (code 5001) or unsupported binding operation (3010). I have to use tablebindings, because i can't apply formatting to anything else according to the MSDN documentation.</p>
  
  <p>The following solutions are unacceptable:</p>
  
  <ul>
  <li>forcing the user to use a specific document template with preexisting named tables</li>
  <li>forcing the user to select cell "A1" before my Add-In gets to work.</li>
  <li>forcing the user to select a range prior to inserting the data.</li>
  </ul>
  
  <p>All of which are nightmarish solutions from a usability point-of-view.</p>
  
  <p>I <em>can</em> create a binding from named item and construct the range by counting columns and rows and building a string like this "A1:C232" but this only works once, because:</p>
  
  <ul>
  <li>i can't delete the data (yes. calling "deleteAllDataValuesAsync" on a binding  created with such a named range throws error 3010 (even though the binding say's it's a "table" binding.. wat?).</li>
  <li>i can't overwrite it with data of different size (overwrite error)</li>
  <li>i can't set formatting on it (yes, it's a binding created as a tablebinding, yes, i can call the setFormatAsync function, and it throws an "internal error, 5001" -> #headdesk</li>
  </ul>
  
  <p>I hope someone from Microsoft reads this and can point me in the right direction. I really hope! Because i'm starting to fear that this is actually by design. (i'm so frustrated by office.js after the last few weeks of struggle, i'm having a hard time not ranting, so i'll stop right here.. don't get me started on ui fabric)</p>