Need help changing a function to delete columns instead of rows

2 views (last 30 days)
I found a function online that can import data into google sheets and it has a way to delete rows in the file but not columns. I looked through and unable to identify what part of the function is even responsible for deleting rows, so I haven't been able to figure out how to make it delete columns. I know its a bit of work, but if anyone is able to look at it and figure it out, that'd be very helpful!
This is the function
  2 Comments
dpb
dpb on 13 Jul 2021
"what part of the function is even responsible for deleting rows, "
That certainly doesn't seem to be hard to track down...
% check if this is a delete row operation
if isempty(d)
...
status = deleteRows(spreadsheetID, sheetID, sheetpos, aSheets);
...
The deleteRows function is internal function within the whole mess of all the code that is all strung together in one file.

Sign in to comment.

Answers (1)

Jayant Gangwar
Jayant Gangwar on 13 Jul 2021
It seems to me you are trying to find a way to delete columns while importing data into google sheets.
The function mat2sheets(spreadsheetID,sheetID,pos,d) has 4 input arguments where the first two are the identifiers of the respective sheets where as the 3rd argument specifies which cell do you want to start writing your data d. Now if you will give an empty array d as an input then this function will automatically delete the rows given in pos, for examples if pos=[2 10] , d=[] , then rows 2-10 will be deleted.
To delete column you can transpose your input data and use the above method to delete the rows.

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!