How to control MCP3008 sampling rate by Arduino & How to write excel file

Hello, thanks you for your recommendations. However, the Arduino Commands of millis() and micros() does not worked for me.

Previously, I using Matlab software interface with Arduino Mega 2560 Board that connected to MCP3008 which able to write correct results (ADC value) into an excel file (.csv) based on Matlab Coding. However, my problem is it only able to produce 1 sample (ADC value) per second in an excel file since my desired result is 100 samples per second or 1000 samples per second because based on datasheet of MCP3008, it can up to 200 kilo samples per second.

Besides, I could not found the "Excel for Arduino application" in Microsoft Website for writing data into a file. Can you send this particular website link to me? So that I can directly download this application.

The Matlab Coding used for performing ADC operation of MCP3008 by Arduino Mega 2560 Board is attached below, the file name known is "subroutine_MCP3008.m", please refer to it.

Thanks you and very appreciate for helpling.

subrountine_MCP3008.m (11.5 KB)