Need help changing a function to delete columns instead of rows

1 Ansicht (letzte 30 Tage)
Darius Karneckij
Darius Karneckij am 12 Jul. 2021
Beantwortet: Jayant Gangwar am 13 Jul. 2021
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 Kommentare
dpb
dpb am 12 Jul. 2021
Just transpose the input array.
dpb
dpb am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jayant Gangwar
Jayant Gangwar am 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.

Community Treasure Hunt

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

Start Hunting!

Translated by