Complete the code to read data from an Excel file named 'data.xlsx'.
data = readtable('[1]');
The readtable function reads data from an Excel file. The filename must be a string with the correct Excel file extension, here 'data.xlsx'.
Complete the code to write the table 'T' to an Excel file named 'output.xlsx'.
writetable(T, '[1]');
The writetable function saves the table T to an Excel file. The filename must be a string with the desired Excel file name, here 'output.xlsx'.
Fix the error in the code to read only the sheet named 'Sheet2' from 'data.xlsx'.
data = readtable('data.xlsx', 'Sheet', [1]);
The sheet name must be a string with quotes and exact case, so use 'Sheet2'. Using a number reads the sheet by index instead of by name, and using an unquoted name causes a syntax error.
Fill both blanks to read data from 'data.xlsx' sheet 'Sales' and write it to 'summary.xlsx'.
data = readtable('[1]', 'Sheet', '[2]'); writetable(data, 'summary.xlsx');
To read from 'data.xlsx' sheet 'Sales', use those exact strings. Writing is done to 'summary.xlsx' already in code.
Fill all three blanks to read 'Sheet1' from 'input.xlsx', select rows where 'Age' > 30, and write to 'filtered.xlsx'.
data = readtable('[1]', 'Sheet', '[2]'); filtered = data(data.[3] > 30, :); writetable(filtered, 'filtered.xlsx');
Read from 'input.xlsx' sheet 'Sheet1'. Filter rows where the column 'Age' is greater than 30. Then write filtered data to 'filtered.xlsx'.