How to add data into the first row of an existing excel sheet and shift the existing data down

8 views (last 30 days)
I am adding data to excel daily. Originally I would add a new row to the end to many excel files and sheets using xlswrite.
  • For example: if there are 200 rows, I run the code and it adds a row in the 201st spot.
I am making plots of all of this data in the excel files/sheets but unfortunately when I add a row at the end the plots wont update. If I add a row anywhere else before the end, the plots recognize it and will update. My only job now would be to sort the data in each file/sheet vs updating various parameter ranges for every plot in each file/sheet.
  • For example: I would like to add a row to A1 and shift the existing 200 rows down for a total of 201 rows.

Accepted Answer

Varun Bhaskar
Varun Bhaskar on 25 Aug 2015
Hi Calabrese,
This workflow is not possible with xlswrite. The workaround would be to retrieve all the rows in the Excel file into a variable in MATLAB via xlsread, then concatenate those rows to the row to be inserted right at the beginning. You can then write the whole block of data into Excel using xlswrite.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!