Indexed read write on SD card

I have a requirement as below :

The SD card is written with many rows of data pulled from a XLS file. Each row has a structure as below :

INDEX 001, A-12345, NAME ABCD, 12 \n

I now should be able to open the SD card, read only the first INDEX 001 row and display the values on a LCD.
The user does something based on this and I now have to write back the above row with additional value and data time stamp as below into another file :

INDEX 001, A-12345, NAME ABCD, 12, 11.5, 12.30, 05DEC2015 \n

Then I go fetch the INDEX 002 row and process as above.

I am not sure if they above is possible with the standard SD library. Could someone guide with options ?? Thanks in advance.

I am not sure if they above is possible with the standard SD library

Unless the records are fixed length (they could be, but are not in your example), is it not possible to write a longer record in place of a shorter record, and expect the rest of the data to move automatically.

Dear Paul,

You are very right to point out about fixed record length.

In fact I have been spending lots of time reading about this particular subject in this forum wherein you have given lots of suggestions for similar such requests.

What I have decided is this :

Have two different files : PlanData.csv and ActualData.csv

  • The PlanData.csv is a XLS file converted to a 2-D array and downloaded to the SD card.

  • Each row has an end marker.

  • I then read this array from SD into the MCU memory ( SRAM ? ) or push it to a add on memory chip if the size is more than the SRAM capacity.

  • From there I can choose the rows one by one for processing.

  • Once each row is processed, I open ActualData.csv and write the appended data along with the plan data.

How does the above idea look ??

How does the above idea look ?

The concept seems reasonable, if you can't make the one file contain fixed length records.