Search code examples
excelvbaposthttp-postxlsx

Send workbook via POST without saving


I want to send a dynamically created workbook via a POST request. In case when I have a file, it is easy to do. Is it possible to avoid the part of saving it into the file? Thanks!


Solution

  • To answer the actual question: This is not possible.

    Because you can only send via POST what exists. If you want to send a file, that file needs to exist. If you don't save that file it doesn't exist yet. So you need at least save it in the temp folder and delete it after sending.

    Depending on if you are in control of the server API you can ask for a JSON with the data only, so you can submit the data without the huge overhead of an Excel file. If you are not in control over the server API and Excel files is the only that the API accepts, then your only option is to save the file temporarily.